Simple Vendor

//Simple Vendor 
//Version: 1.0.0 
// 
string name = "name of person"; 
integer price = 10; // adjust accordingly 
string item = "nameofitem"; 
 
default 
{ 
   state_entry() 
   { 
      llRequestPermissions( llGetOwner(), PERMISSION_DEBIT ); 
   } 
   run_time_permissions(integer perms) 
   { 
      if (perms & PERMISSION_DEBIT) 
         state run; 
   } 
} 
 
state run 
{ 
   money(key id, integer amount) 
   { 
      if (llKey2Name(id) == name) 
      { 
         if (amount != price) 
         { 
            llWhisper(0,"Sorry!  The price is $" + (string)price); 
            llGiveMoney(id,amount); 
         } 
         else 
         { 
            llGiveInventory(id,item); 
            llInstantMessage(llGetOwner(),name + " bought their item."); 
            state sold; 
         } 
      } 
      else 
      { 
         llWhisper(0,"Sorry I'm only selling this to " + name); 
         llGiveMoney(id,amount); 
      } 
   } 
} 
 
state sold 
{ 
   state_entry() { } 
}
Navigation

Alternative Startseite
Helpdesk
Links
Maps
Radio
Suchmaschine


Drucken/exportieren