Access (NewAge)
Revision as of 12:01, 16 October 2012 by Kireji Haiku (talk | contribs) (removed some redundant elses in userfunctions where returning values)
Access Script
Note: This script is for people who have knowledge of coding
How to use?
Change the Access varible to one of the three; 'Public' 'Group' 'Owner'
Returns TRUE if user UUID is allowed to continue using. Returns FALSE if user UUID is not permitted to use.
<lsl> if(asAccessCheck(key id) == TRUE) { ... </lsl>
<lsl>
// NewAge Access Script
// By Asia Snowfall
// Version 1.0
//
//
// Access Mode:
// public = anybody
// group = agents with the same active group
// owner = owner only
string accessMode = "public";
key asObjectOwner() {
key thisPrim = llGetKey(); list details = llGetObjectDetails(thisPrim, [OBJECT_OWNER]);
return llList2Key(details, 0);
}
integer asAccessCheck(key id) {
string accessModeToLower = llToLower(accessMode);
if (accessModeToLower == "public") return TRUE;
else if (accessModeToLower == "group" || asObjectOwner() == id) { if (llSameGroup(id)) return TRUE; // else return FALSE; } else if (accessModeToLower == "owner") { if (asObjectOwner() == id) return TRUE; // else return FALSE; }
// else
return FALSE;
}
default {
touch_start(integer num_detected) { key id = llDetectedKey(0);
// PUBLIC_CHANNEL has the integer value 0
if (asAccessCheck(id)) llWhisper(PUBLIC_CHANNEL, "Access Granted"); else llWhisper(PUBLIC_CHANNEL, "Access Denied"); }
} </lsl>