Last active
February 5, 2018 23:29
-
-
Save pravatbhusal/0b3aa916fa41bf08067a0d3a11cb332e to your computer and use it in GitHub Desktop.
Actionscript 3.0 avatar anti-rip code for the website http://www.whirled.com/. Put this code below your "Basic Avatar Code" code and add any new player IDs or URLs into the the two arrays.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var playerIdWhiteList :Array = [ | |
2, //add more player IDs into this array | |
4 | |
]; | |
var urlWhiteList: Array = [ | |
"glowbe.online", //add more URLs into this array | |
"tensortown.com" | |
]; | |
var websiteURL:String = loaderInfo.loaderURL; | |
for(var i:Number = 0; i < urlWhiteList.length; i++) { | |
if(websiteURL.indexOf(urlWhiteList[i]) >= 0 || websiteURL.indexOf("http") == -1) { | |
//check if the player id is allowed to be used from the whitelist | |
if (_ctrl.getEnvironment() != EntityControl.ENV_VIEWER && playerIdWhiteList.indexOf(_ctrl.getEntityProperty(EntityControl.PROP_MEMBER_ID)) < 0) { | |
this.root.visible = false; | |
_ctrl.registerActions("This avatar is restricted to " + playerIdWhiteList); | |
_ctrl.registerStates(); | |
_ctrl.registerCustomConfig(null); | |
_ctrl.registerPropertyProvider(null); | |
} | |
break; | |
} | |
//the program iterated through every url whitelist but couldn't find a result, so throw an error | |
if(i == urlWhiteList.length - 1) { | |
this.visible = false; | |
throw new Error("ERROR! This item is NOT uploaded on a whitelisted website!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment