Set a password for a script !
First time we ask a password then encrypt it and set to description Object, Next time only we decrypt from get description of object !
the crypt could store also in notepad
---------------------------------------------
string Crypt="123456789";
string password ="";
string action="";
integer listenHandle;
default
{
state_entry()
{
listenHandle = llListen(10, "", "llDetectedKey(0)", "");
}
touch_start(integer total_number)
{
if(llGetObjectDesc()=="EMPTY")
{
llTextBox( llDetectedKey(0),"Please enter your Password (to define)",10);
action = "password";
}
else
{
llTextBox( llDetectedKey(0),"Please enter your Password ...",10);
action = "verify password";
}
}
listen(integer channel, string name, key id, string message)
{
llSay(0,"MESSAGE IS "+ message);
if (action == "password")
{
password = message;
string datacrypt = llXorBase64StringsCorrect(llStringToBase64(password), llStringToBase64(Crypt));
llSetObjectDesc(datacrypt);
}
if (action == "verify password")
{
password = message;
llSay(0,"pass s "+password);
string verify = llBase64ToString(llXorBase64StringsCorrect(llGetObjectDesc(), llStringToBase64(Crypt)));
if (verify == password)
{
llSay(0,"OKAY "+password);
}
else
llSay(0,"Bad pass "+password);
}
}
}