Camping Script with Notecard

Written by: Headmaster

-Rez the object on the ground - Right click it, and go into the edit menu. On the content tab you will find a Settings Notecard and a script. - Edit the Settings notecard, and type in at the first line the amount of money that you want to pay. On the second line type the payment periode in seconds (300 sec. = 5 min). So the notecard shoul look like this : 2 300 30 This means that you will pay 2L every 5 minutes. The third line is the camping limit in lindens.Default is 30, so if camper reaches 30L then he will be stand up. Enjoy the Camping Toilet.

The Script:

integer campmoney = 0;
integer campadd = 0;
integer camptime = 300;
string reciever;
integer pula;
integer limit;
string gName = "Settings";    
integer gLine = 0; 
key gQueryID;
default {
    
    dataserver(key query_id, string data)
  {         if (query_id == gQueryID) 
            {    if (data != EOF)
                 {   

                 if (gLine == 0)
                 {
                 campadd = (integer)data;
                 }
                 if (gLine == 1)
                 {
                 camptime = (integer)data;
                 pula = camptime/60;
                 }
                 if (gLine == 2)
                 {
                     limit = (integer)data;
                }   
             
                  ++gLine;      
                  gQueryID = llGetNotecardLine(gName, gLine);   
                }
            }
       
  }
   
    state_entry() {
          gQueryID = llGetNotecardLine(gName, gLine); 
      
         llRequestPermissions(llGetOwner(),PERMISSION_DEBIT  );
       
         llSetText("Sit here to Make Money .\nL$"+(string)campadd+" every "+(string)pula+" minutes",<0,1,0>,1);
      
      llSitTarget(<0,0,-0.6>, <180,0,0,0>); 
    }
    changed(integer change) { 
        if (change & CHANGED_LINK) { 
            if (llAvatarOnSitTarget() != NULL_KEY) { 
                reciever = llAvatarOnSitTarget();
                llSetText("Money Made:"+(string)campmoney,<0,1,0>,1);
             
                llSetTimerEvent(camptime);
               
            }
            else{if (campmoney > 0) {
            llGiveMoney(reciever,campmoney);}
            reciever="";
             campmoney=0;   
         llSetText("Sit here to Make Money .\nL$"+(string)campadd+" every "+(string)pula+" minutes",<0,1,0>,1);
        
 llSetTimerEvent(100000000);
            }
        }
}on_rez(integer start_param)
{llResetScript();}

    timer()
        {   campmoney = campmoney+campadd;
            llSetText("Money:"+(string)campmoney,<0,1,0>,1);
            if (llAvatarOnSitTarget() != NULL_KEY)
            { 
                 if ( campmoney == limit ) {llUnSit(reciever);}
        }
        else
            {
                reciever="";
             campmoney=0;   
            llSetText("Sit here to Make Money .\nL$"+(string)campadd+" every "+(string)pula+" minutes",<0,1,0>,1);
            
 llSetTimerEvent(100000000);
            }
        }
}

 

Notecard:

2
10
30 

 

 

Category: