User:Daemonika Nightfire/Scripts/Anti copy trans
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 function, 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) ╚══════════════════════−−−→
- /
// change the keys or add more if you like list listOfCreatorOrResellerKeys = [
"61ee201a-81cf-4322-b9a8-a5eb8da777c2",
"00000000-0000-0000-0000-000000000000"];
check_script_permission_mask() {
llSetText("", ZERO_VECTOR, 0.0);// black and transparent
key ownerKey = llGetOwner(); string thisScript = llGetScriptName();
// pay attention to ~, it's bitwise NOT and not -
integer foundOwnerKeyInListOfCreatorOrResellerKeys = ~llListFindList(listOfCreatorOrResellerKeys, [ownerKey]);
// when the owner can't be found in the list
if (!foundOwnerKeyInListOfCreatorOrResellerKeys)
{
// if the ownerkey don't match, the script will delete itself when permission copy & tranfer is given
integer ownerPermMask = llGetInventoryPermMask(thisScript, MASK_OWNER);
if((ownerPermMask & PERM_TRANSFER) && (ownerPermMask & PERM_COPY))
{
llOwnerSay("/me " + thisScript + ": Sorry, i was not made for you. Goodbye!");
llRemoveInventory(thisScript);
}
}
// force the reseller to set (no copy) or (no trans), otherwise the script will not work
integer nextOwnerPermMask = llGetInventoryPermMask(Script, MASK_NEXT);
if((nextOwnerPermMask & PERM_TRANSFER) && (nextOwnerPermMask & PERM_COPY))
{
llSetText("Please correct the script-permission to:\n"
+ "(copy/no transfer) or (no copy/transfer)", <1.0, 1.0, 0.1>, 1.0);// yellow and opaque
state permsNotSetCorrectly;
}
}
default {
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
llResetScript();
}
state_entry()
{
check_script_permission_mask();
}
touch_start(integer num_detected)
{
// uncomment next line for debug purposes
// llSay(PUBLIC_CHANNEL, "Yay, script-permission correct.");
}
}
state permsNotSetCorrectly {
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
llResetScript();
}
state_entry()
{
llSay(PUBLIC_CHANNEL, "Sorry, please correct the script-permissions.");
}
touch_start(integer num_detected)
{
llSay(PUBLIC_CHANNEL, "Sorry, please correct the script-permissions.");
}
} </lsl>