integer amount=10;// how much you wanna give away
default//this is the normal state we are used to, call it the first one
{
touch_start(integer num_detected)
{
if(llDetectedKey(0)==llGetOwner())
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);//asks for permission to give out L$
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_DEBIT)
{
llOwnerSay("Permissions passed...ready to work"
;state run; //if you give it permission it goes to the next state
}
else
{
llOwnerSay("Invalid Permissions...resetting now"
;state reset; //if not it goes to the reset state
}
}
changed(integer change) { // something changed
if (change & CHANGED_OWNER) { state reset;}}
}
state run // the state what runs (the main one in this case)
{
state_entry()
{
llOwnerSay("Ok its time to give out some L$"
;}
touch_start(integer total_number)
{
llGiveMoney(llDetectedKey(0),amount);
state sleep; // The state that sleeps (massachuesetttes?)
}
}
state reset // Saves writing llResetScript all ove the place
{
state_entry()
{
llResetScript();
}
}
state sleep // The sleepy bit sets the time and then goes to the main state
{
state_entry()
{
llSetTimerEvent(86400);
}
timer()
{
state run;
}
touch_start(integer total_number)
{
integer i;
for(i=0;i<total_number;i++)
{
if( llDetectedGroup(i)==FALSE )
{
llSay(0, "Sorry, " + llDetectedName(i) + " but I'm not giving you anything because you're not wearing the right group tag."
;}
else
{
llSay(0, "Good news, " + llDetectedName(i) + " you are wearing the right tag, so you get the money."
;// plus whatever it does to give them money, obviously.
}
}
}
}
but when its like this is gives out the money then asks for the group tag.
I want it to only give out the money if they are wearing my group tag
