Jump to content

How to make it only clickable for two users?


CWitchGamer
 Share

You are about to reply to a thread that has been inactive for 1409 days.

Please take a moment to consider if this thread is worth bumping.

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!");
        }
    }
}
 

Link to comment
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
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1409 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...