Last active
February 5, 2018 23:29
-
-
Save pravatbhusal/13a1983142e5cc37be888ca02b39e716 to your computer and use it in GitHub Desktop.
Actionscript 3.0 furniture or toy anti-rip code for the website http://www.whirled.com/. Put this code in a new layer below all other layers of your furniture or toy, then add new indexes of profile-ids into the white-list array.
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
import com.whirled.ControlEvent; | |
import com.whirled.EntityControl; | |
import flash.utils.Timer; | |
import flash.events.TimerEvent; | |
var whitelist :Array = [ | |
2, // the original creator of the toy | |
526 // any other player ids you wish to add | |
]; | |
//if the authentication memory was never set | |
if(_ctrl.getMemory("authentication", null) == null) { | |
_ctrl.sendMessage("authenticate_message", _ctrl.getInstanceId()); | |
_ctrl.addEventListener(ControlEvent.MESSAGE_RECEIVED, authenticationMessage); | |
} | |
function authenticationMessage(E:ControlEvent): void { | |
//set the authentication to false as long as the memory is still null or still false | |
if(_ctrl.getMemory("authentication", null) == null || Boolean(_ctrl.getMemory("authentication", null)) != true){ | |
_ctrl.setMemory("authentication", false); | |
} | |
//keep checking if the instance is whitelisted | |
if(String(E.name) == "authenticate_message" && whitelist.indexOf(Number(E.value)) >= 0) | |
{ | |
_ctrl.setMemory("authentication", true); | |
this.root.visible = true; | |
} | |
} | |
//grant access to the use of the toy if the authentication is true or if you're not in the viewer or shop | |
function checkAccess() | |
{ | |
if(Boolean(_ctrl.getMemory("authentication", null)) == true || _ctrl.getEnvironment() == "viewer" || _ctrl.getEnvironment() == "shop") | |
{ | |
this.root.visible = true; | |
} else { | |
this.root.visible = false; | |
} | |
} | |
checkAccess(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment