User:Daemonika Nightfire/Scripts/Anti copy trans

From Second Life Wiki
< User:Daemonika Nightfire
Revision as of 11:31, 1 November 2012 by Daemonika Nightfire (talk | contribs) (Created page with "==*DS* Anti (copy & transfer)== This funktion allows you to give away scripts with copy & transfer permissions and force the reseller to change the permission. Additionally the s…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

*DS* Anti (copy & transfer)

This funktion allows you to give away scripts with copy & transfer permissions and force the reseller to change the permission. Additionally the script will delete itself when the customer of the reseller receives it with both permissions. Because it is a global funkcion, it can be used universally.

Make sure that you not give away scripts with modify rights which contains this function.

<lsl> /*

   ╔═════════════════════════════════════−−−­­­­­­→
   ║ *DS* Anti (copy & transfer) © by Daemonika Nightfire (daemonika.nightfire)
   ╚══════════════════════−−−­­­→
  • /

// stored key's (UUID) of creator and reseller list CreatorKey = ["61ee201a-81cf-4322-b9a8-a5eb8da777c2","00000000-0000-0000-0000-000000000000"]; // expandable

////////// global function \\\\\\\\\\ CorrectPerms?() {

   string Script = llGetScriptName(); // ask for scriptname
   llSetText("", ZERO_VECTOR, 0.0); // clear floatingtext
   
   // compares the ownerkey with the key's in the list
   if(llListFindList(CreatorKey, llCSV2List(llGetOwner())) == -1)
   {
       // if the ownerkey don't match, the script will delete itself when permission copy & tranfer is given
       integer MaskOwner = llGetInventoryPermMask(Script, MASK_OWNER);
       if((MaskOwner & PERM_TRANSFER) && (MaskOwner & PERM_COPY) != 0)
       {
           llOwnerSay("/me " + Script + ": Sorry, i was not made for you. Goodbye");
           llRemoveInventory(Script);
       }
   }
   
   // force the reseller to set (no copy) or (no trans), otherwise the script will not work
   integer MaskNext = llGetInventoryPermMask(Script, MASK_NEXT);
   if((MaskNext & PERM_TRANSFER) && (MaskNext & PERM_COPY) != 0)
   {
       llSetText("please correct the script-permission to:\n(copy/no transfer) or (no copy/transfer)", <1,1,0>, 1.0);
       state Offline;
   }

}

default {

   state_entry()
   {
       CorrectPerms?(); // starts the global function
   }
   touch_start(integer total_number) // just for show that it work
   {
       llSay(0, "Yay, script-permission correct.");
   }
   
   changed(integer change)
   {
       if(change & (CHANGED_OWNER|CHANGED_INVENTORY))
       {
           llResetScript();
       }
   }
   
   on_rez(integer Dae)
   {
       llResetScript();
   }

}

state Offline {

   state_entry()
   {
       llOwnerSay("Sorry, please correct the script-permission");
   }
   
   changed(integer change)
   {
       if(change & (CHANGED_OWNER|CHANGED_INVENTORY))
       {
           llResetScript();
       }
   }
   
   on_rez(integer Dae)
   {
       llResetScript();
   }

} </lsl>