Anti theft code: Difference between revisions

From Whirled Club Wiki
Jump to navigation Jump to search
(Created page with "<actionscript> // The numbers in your whitelist are player IDs that may wear the avatar // You can get your player ID by looking at the number in the URL of your profile...")
 
No edit summary
Line 6: Line 6:
     878, // Add more for friends who can also wear this avatar
     878, // Add more for friends who can also wear this avatar
]
]
if (_ctrl.getEnvironment() != EntityControl.ENV_VIEWER &amp;&amp; whitelist.indexOf(_ctrl.getEntityProperty(EntityControl.PROP_MEMBER_ID)) &lt; 0) {
if (_ctrl.getEnvironment() != EntityControl.ENV_VIEWER &amp;&amp; whitelist.indexOf(_ctrl.getEntityProperty(EntityControl.PROP_MEMBER_ID)) &lt; 0) {
     this.root.visible = false;
     this.root.visible = false;

Revision as of 16:58, 25 August 2018

<actionscript> // The numbers in your whitelist are player IDs that may wear the avatar // You can get your player ID by looking at the number in the URL of your profile var whitelist :Array = [

   9001, // Replace with your player ID
   878, // Add more for friends who can also wear this avatar

]

if (_ctrl.getEnvironment() != EntityControl.ENV_VIEWER && whitelist.indexOf(_ctrl.getEntityProperty(EntityControl.PROP_MEMBER_ID)) < 0) {

   this.root.visible = false;
   _ctrl.registerActions("This avatar is restricted to " + whitelist, "Contact the seller if you bought this avatar");
   _ctrl.registerStates();
   _ctrl.registerCustomConfig(null);
   _ctrl.registerPropertyProvider(null);

} </actionscript>

Don't forget to import com.whirled.EntityControl and set up your _ctrl object. This should also work with pets, if you remove the calls to registerStates and registerActions.

Aduros sez: I haven't fully tested this, so send me a mail if it doesn't work!