Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer timeToGive1 = 560; // Time required for campers to camp (in seconds)
- string prize1 = "Dunkle Macht"; // The name of the prize (must be in the camp chair's inventory)
- string animation; // the first animation in inventory will automatically be used
- // the animation name must be stored globally to be able to stop the animation when standing up
- integer ctlChannel = 123221; // Control channel, default is 12321, MUST CHANGE THIS!!!
- // Internal Veriables
- integer sitTime = 0;
- key sitter;
- string sitterName;
- default
- {
- state_entry()
- {
- if (prize1 == "")
- {
- prize1 = llGetInventoryName(INVENTORY_OBJECT,0);
- }
- llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
- }
- changed(integer change)
- {
- if (change & CHANGED_LINK)
- {
- key av = llAvatarOnSitTarget();
- if (av) //evaluated as true if not NULL_KEY or invalid
- llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
- else // avatar is standing up
- {
- if (animation)
- llStopAnimation(animation); // stop the started animation
- llResetScript(); // release the avatar animation permissions
- }
- }
- }
- run_time_permissions(integer perm)
- {
- if (perm & PERMISSION_TRIGGER_ANIMATION)
- {
- animation = llGetInventoryName(INVENTORY_ANIMATION,0); // get the first animation from inventory
- if (animation)
- {
- llStopAnimation("sit"); // stop the default sit animation
- llStartAnimation(animation);
- }
- }
- }
- }
- {
- { llSetText("Ready for camping\nSit here for "+(string) (timeToGive1 / 60)+"minute(s) to get "+prize1+" for free!",<1,1,1>,1);
- sitTime = 0;
- sitter = NULL_KEY;
- sitterName = "No one";
- }
- changed(integer change)
- {
- if (change & CHANGED_LINK) {
- key target = llAvatarOnSitTarget();
- if (target) {
- sitter = target;
- sitterName = llKey2Name(target);
- state sitting;
- }
- }
- }
- }
- state sitting
- {
- state_entry()
- {
- llSetTimerEvent(1.0);
- llListen(ctlChannel,"",NULL_KEY,"");
- }
- listen(integer channel, string name, key id, string msg) {
- if (channel == ctlChannel) {
- if (msg == "kick") {
- llUnSit(sitter);
- }
- }
- }
- timer()
- {
- llSetText(" Chair in use\nOccupied by "+sitterName + "\nwill get "+prize1+" after " + (string) (timeToGive1 - sitTime) + " second(s)",<1,1,1>,1);
- if (sitTime++ > timeToGive1) {
- llGiveInventory(sitter,prize1);
- llUnSit(sitter);
- llSay(0,sitterName + ", thank you for camping, enjoy your prize!");
- state default;
- }
- }
- changed(integer change)
- {
- if (change & CHANGED_LINK) {
- if (llAvatarOnSitTarget() == NULL_KEY)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement