Jump to content
CWitchGamer

How to make it only clickable for two users?

Recommended Posts

Hey guys! Sorry about my English, it's not my first language.

But I'm learning with script. I want make sure it's only private clickable for only two user, for example, Jane and John only clickable and everyone can't click.

Please tell me how make it private clickable for two users only.

 

list buttons = ["Kisses", "Hugs", "Snuggles"];
string dialogInfo = "\nPlease make a choice.";
 
key ToucherID;
integer dialogChannel;
integer listenHandle;
 
default
{
    state_entry()
    {
        dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
    }
 
    touch_start(integer num_detected)
    { 
        ToucherID = llDetectedKey(0);
        llListenRemove(listenHandle);
        listenHandle = llListen(dialogChannel, "", ToucherID, "");
        llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
    }
 
    listen(integer channel, string name, key id, string message)
    {
        if (message == "Kisses")
        {
            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            llSay(0, "John kissed Jane!");
        }
 
        llListenRemove(listenHandle);
 
        if (message == "Hugs")
        {
            // process Red here
            llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            llSay(0,"John hugged Jane!");
        }
        else if (message == "Snuggles")
        {
            // process Green here
           llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
            llSay(0,"John snuggled Jane!");
        }
    }
}
 

Share this post


Link to post
Share on other sites

Consider the following:

	//UUIDs of the users that need access.
list AllowedUsers = ["ce7d01fa-ca25-4651-8895-f528ce5bc723", "0382a02a-e260-45a6-87d3-552c7cdaedea"]; 

    touch_start(integer num_detected)
    { 
        ToucherID = llDetectedKey(0);
      	if(llListFindList(AllowedUsers, [ToucherID]) < 0) return; // Aborts the touch start event if ToucherID
      								  // can not be found in the AllowedUsers list.
      
        llListenRemove(listenHandle);
        listenHandle = llListen(dialogChannel, "", ToucherID, "");
        llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
    }

In this example I generated random UUIDs at a website so these sample IDs are not valid user IDs.  
Replace the UUIDs of AllowedUsers with the UUIDs of the two users (you and your partner?) that should be shown the menu.

That really is all there's to it.

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...