Difference between revisions of "Access (NewAge)"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) (removed some redundant elses in userfunctions where returning values) |
m (<lsl> tag to <source>) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
== Access Script == | == Access Script == | ||
How to use? | How to use? | ||
Change the Access | Change the Access variable to one of the three; | ||
'Public' | 'Public' | ||
'Group' | 'Group' | ||
'Owner' | 'Owner' | ||
Returns TRUE if user UUID is allowed to continue using. | Returns TRUE if user UUID is allowed to continue using. | ||
Returns FALSE if user UUID is not permitted to use. | Returns FALSE if user UUID is not permitted to use. | ||
< | <source lang="lsl2"> | ||
// NewAge Access Script | // NewAge Access Script | ||
// By Asia Snowfall | // By Asia Snowfall | ||
// Version | // Version 2 | ||
// | // | ||
// Access Mode: | // Access Mode: | ||
Line 31: | Line 22: | ||
string accessMode = "public"; | string accessMode = "public"; | ||
integer asAccessCheck(key id) | integer asAccessCheck(key id) | ||
Line 45: | Line 27: | ||
string accessModeToLower = llToLower(accessMode); | string accessModeToLower = llToLower(accessMode); | ||
if (accessModeToLower == "public") | if (accessModeToLower == "public" || id == llGetOwner() ) | ||
return TRUE; | return TRUE; | ||
if (accessModeToLower == "group") | |||
return llSameGroup(id); | |||
return FALSE; | |||
} | } | ||
Line 70: | Line 40: | ||
touch_start(integer num_detected) | touch_start(integer num_detected) | ||
{ | { | ||
if (asAccessCheck( llDetectedKey(0) )) | |||
llWhisper(0, "Access Granted"); | |||
llWhisper( | |||
else | else | ||
llWhisper( | llWhisper(0, "Access Denied"); | ||
} | } | ||
} | } | ||
</ | </source> |
Latest revision as of 19:14, 24 January 2015
Access Script
How to use?
Change the Access variable 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.
// NewAge Access Script
// By Asia Snowfall
// Version 2
//
// Access Mode:
// public = anybody
// group = agents with the same active group
// owner = owner only
string accessMode = "public";
integer asAccessCheck(key id)
{
string accessModeToLower = llToLower(accessMode);
if (accessModeToLower == "public" || id == llGetOwner() )
return TRUE;
if (accessModeToLower == "group")
return llSameGroup(id);
return FALSE;
}
default
{
touch_start(integer num_detected)
{
if (asAccessCheck( llDetectedKey(0) ))
llWhisper(0, "Access Granted");
else
llWhisper(0, "Access Denied");
}
}