I want to make a teleport script with a list op people that are allowed to use it and the other
people will teleport to another location.
The script i made sometimes works and sometimes not but the people on the accesslist (whitelist) always have to click on it before they teleport. I hope someone knows a better solution for this. ( The teleport works but not always to the correct location)
This Script is Free to use for everybody who wants it and if i solve the problems i will post the fixed script here too.
key nrofnamesoncard;
integer nrofnames;
list names;
list keynameoncard;
vector target1=<18, 16, 443>; //People that are allowed
vector target2=<19, 9, 401>;
vector offset;
default
{
state_entry()
{
nrofnamesoncard = llGetNumberOfNotecardLines("whitelist"
; }
dataserver (key queryid, string data){
if (queryid == nrofnamesoncard)
{
nrofnames = (integer) data;
llOwnerSay("Found "+(string)nrofnames+ " names in whitelist."
;integer i;
for (i=0;i < nrofnames;i++){
keynameoncard += llGetNotecardLine("whitelist", i);
}
} else
{
integer listlength;
listlength = llGetListLength(keynameoncard);
integer j;
for(j=0;j<listlength;j++) {
if (queryid == (key) llList2String(keynameoncard,j))
{
names += data;
}
}
}
if (llGetListLength(names) == nrofnames)
{
state Teleport;
}
}
}
state Teleport
{
state_entry()
{
offset = (target2- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSetSitText("Teleport"
;llSitTarget(offset, ZERO_ROTATION);
}
changed(integer change)
{ // something changed
if (change & CHANGED_LINK)
{ // and it was a link change
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
llUnSit(llAvatarOnSitTarget()); // unsit him
llResetScript() ;
}
}
}
touch_start(integer i)
{
string nametotest = llDetectedName(0);
llSay(0,llDetectedName(0));
integer j;
for (j = 0; j < llGetListLength(names); j++)
{
if (llList2String(names, j) == nametotest)
{
offset = (target1- llGetPos()) * (ZERO_ROTATION / llGetRot());
}
else
{
offset = (target2- llGetPos()) * (ZERO_ROTATION / llGetRot());
}
}
llSetSitText("Teleport"
;llSitTarget(offset, ZERO_ROTATION);
}
}