Difference between revisions of "Access (NewAge)"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '== 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' Ret...')
 
m (<lsl> tag to <source>)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Access Script ==
== Access Script ==
'''Note: This script is for people who have knowledge of coding'''


How to use?
How to use?


Change the Access varible to one of the three;
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.


<lsl>
<source lang="lsl2">
if(asAccessCheck(key id) == TRUE)
{ ...
</lsl>
 
 
<lsl>
/////////////////////////////////
// NewAge Access Script
// NewAge Access Script
// By Asia Snowfall
// By Asia Snowfall
// Version 1.0
// Version 2
/////////////////////////////////
//
// Access Mode:
//     public = anybody
//     group  = agents with the same active group
//     owner  = owner only


string Access = "public";
string accessMode = "public";


// Access Types;
integer asAccessCheck(key id)
// Public = Everyone can use
// Group = Group Only
// Owner = Owner Only
 
key asObjectOwner()
{
{
     list details = llGetObjectDetails(llGetKey(), [OBJECT_OWNER]);
     string accessModeToLower = llToLower(accessMode);
    return (key)llList2CSV(details);
}


integer asAccessCheck(key id)
     if (accessModeToLower == "public" || id == llGetOwner() )
{
     if(llSubStringIndex(llToLower(Access), "public") != -1)
    {
         return TRUE;
         return TRUE;
    }
 
     else if((llSubStringIndex(llToLower(Access), "group") != -1)||(asObjectOwner() == id))
     if (accessModeToLower == "group")
    {
         return llSameGroup(id);
         if(llSameGroup(id) == TRUE)
 
        {
     return FALSE;
            return TRUE;
        }
        else
        {
            return FALSE;
        }
     }
    else if(llSubStringIndex(llToLower(Access), "owner") != -1)
    {
        if(asObjectOwner() == id)
        {
            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
    else
    {
        return FALSE;
    }
}
}


default
default
{
{
     touch_start(integer x)
     touch_start(integer num_detected)
     {
     {
         if(asAccessCheck(llDetectedKey(0)) == TRUE)
         if (asAccessCheck( llDetectedKey(0) ))
        {
             llWhisper(0, "Access Granted");
             llWhisper(0, "Access Granted");
        }
         else
         else
        {
             llWhisper(0, "Access Denied");
             llWhisper(0, "Access Denied");
        }
     }
     }
}
}
</lsl>
</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");
    }
}