Dragger Allen
Registered User
Join date: 3 Mar 2007
Posts: 247
|
03-28-2007 05:12
Hi I am looking for a script for a door that can only be opened by paying it X amount of $ with X being changable by the owner
If this script is out there for sale can you please Direct me to a location i may find it
or if you have Created it and would like to share it i will accept that and add a donation to your favorate charity
Thank you in advance
Dragger
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
03-28-2007 07:02
// ExampleMoney // Pay the object money, this script refunds incorrect payments // This code is public domain. integer DOOR_OPEN; //Door status - Closed integer DOOR_NORMAL; //Door swing one way/opposite way integer DOOR_HORIZ; //Door swings around horizontal axis integer gCorrectAmount = 10; // this defines the correct price -- we only accept L$10
swingDoor() { rotation rot; rotation delta; float pivalH; float pivalV;
llTriggerSound("Hinge Squeek",0.8); pivalV= PI/4; if (DOOR_OPEN==TRUE) pivalV = -pivalV; if (DOOR_NORMAL==FALSE) pivalV = -pivalV; if (DOOR_HORIZ==TRUE){ pivalH=pivalV; pivalV=0; } rot=llGetRot(); delta=llEuler2Rot(<0,pivalH,pivalV>); rot=delta*rot; llSetRot(rot); llSleep(0.25); rot=delta*rot; llSetRot(rot); DOOR_OPEN= !DOOR_OPEN; if (DOOR_OPEN==TRUE)llSetTimerEvent(600.0); //to shut gate in 10 minutes seconds else llSetTimerEvent(0.0); }
default { state_entry() { // get permission from the owner to pay out money using the llGiveMoney function. llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); //Restrict to one price llSetPayPrice(PAY_HIDE, [10, PAY_HIDE, PAY_HIDE, PAY_HIDE]); DOOR_OPEN=FALSE; DOOR_NORMAL=FALSE; DOOR_HORIZ=FALSE; }
money(key id, integer amount) { // has the user paid the correct amount? if (amount == gCorrectAmount) { // if so, thank the payer by name. llSay(0,"Thank you, " + llKey2Name(id) + "The gate will remain open for 10 minutes."); swingDoor(); }
// is the amount paid less than it needs to be? else if (amount < gCorrectAmount) { // if so, tell them they're getting a refund, then refund their money. llSay(0,"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + "."); llGiveMoney(id, amount); // refund amount paid. }
// if it's not exactly the amount required, and it's not less than the amount required, // the payer has paid too much. else { // tell them they've overpaid. integer refund = amount - gCorrectAmount; // determine how much extra they've paid. llSay(0,"You paid too much, " + llKey2Name(id) + ". Your change is L$" + (string)refund + "."); llGiveMoney(id, refund); // refund their change. } } timer() { swingDoor(); } // touch_start(integer i) // { // swingDoor(); // } }
|
Dragger Allen
Registered User
Join date: 3 Mar 2007
Posts: 247
|
03-28-2007 07:14
thanks so very much AnnMarie i can not wait ot get home and sitck it in a door
whats your favorite Sl Charity so i can make a donation as i said i would
|
Sys Slade
Registered User
Join date: 15 Feb 2007
Posts: 626
|
03-28-2007 09:00
Be aware that it's extremely easy to go through walls, doors, floors or ceilings in SL. If you are trying to prevent the use of whatever is behind the door by those who haven't paid, you'll probably want to integrate the door with the objects, and unsit/ignore/boot anyone who hasn't got in by paying.
|