CODE
// EZ Single Object Vendor System
// Author: Devon Cassidy
// This script is to be used by anyone in their own One Object Vendor Systems.
// Feel free to do as you please with this script.
integer price = 0; //Price of the object goes here, change to whatever you want
string item = "item name here"; // Write the EXACT name of the object you want to sell
string wrong = "Sorry, that is not the correct pricet"; // This is the message your vendor will say when the person underpays the vendor
string over = "You have overpaid, here is your change"; //This is the message your vendor will say when a person overpays the vendor
string thank = "Thank you for your purchase"; //This is a message thanking your buyer for purchasing your object, its very courteous for you to thank them after they buy something
default
{
on_rez(integer total_number)
{
llResetScript();
}
state_entry()
{
llWhisper(0, "EZ Vendor!");
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); //Make sure you click YES when the debit dialog pops up or youll have some very unhappy customers >_<. This insures that they will get their change back if they overpay or underpay
}
money(key id, integer amount)
{
if(amount < price)
{
llSay(0, wrong);
llGiveMoney(id, amount);
}
if(amount > price)
{
llSay(0, over);
llGiveMoney(id, amount - price);
llGiveInventory(llDetectedKey(0), item);
}
if(amount = price)
{
llSay(0, thank);
llGiveInventory(llDetectedKey(0), item);
}
}
}
=========================================================
If you find any problems in this script please spot them out and fix them for me. I had
to write this in SciTE ez which does not compile the scripts but im pretty sure that
this should work ^_^.


