Camp Chair

Written by: Headmaster
integer campmoney = 0;
integer campadd = 2;
integer camptime = 300;
string reciever;
default {
        state_entry() {
                llRequestPermissions(llGetOwner(),PERMISSION_DEBIT  );
                llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
                llSitTarget(<0.4, 0, 0.6>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
                // Note that if both the vector and the rotation are zero,
                // the SitTarget is removed instead of set and the following will not work:
        }
 
        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
                                reciever = llAvatarOnSitTarget();
                                llSetText("Money:"+(string)campmoney,<0,1,0>,1);
                                llSetTimerEvent(camptime);
                                //llSay(0, "Get off!");
                                //llUnSit(llAvatarOnSitTarget()); // unsit him
                        }
                        else{
                                llGiveMoney(reciever,campmoney);
                                reciever="";
                                campmoney=0;
                                llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
                                llSetTimerEvent(100000000);
                        }
                }
        }
        timer()
        {
                campmoney = campmoney+campadd;
                llSetText("Money:"+(string)campmoney,<0,1,0>,1);
                if (llAvatarOnSitTarget() != NULL_KEY)
                {
                }
                else
                {
                        reciever="";
                        campmoney=0;
                        llSetText("sit here for free money,\nL$"+(string)campadd+" every 5 minutes",<0,1,0>,1);
                        llSetTimerEvent(100000000);
                }
        }
}

 

Category: