seat.lsl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // :CATEGORY:Helicopter
  2. // :NAME:Helicopter scripts
  3. // :AUTHOR:Anonymous
  4. // :CREATED:2013-09-06
  5. // :EDITED:2013-09-18 15:38:54
  6. // :ID:377
  7. // :NUM:523
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // seat prim
  12. // :CODE:
  13. integer sit;
  14. key pilot;
  15. integer listenState( integer listener){ return 1;}
  16. default
  17. {
  18. state_entry()
  19. {
  20. llSay(0, "Hello, Avatar!");
  21. }
  22. // DETECT AV SITTING/UNSITTING AND GIVE PERMISSIONS
  23. link_message(integer sender_number, integer number, string message, key id)
  24. {
  25. if (message == "pilot" & id == NULL_KEY) // no id, means they unsat
  26. {
  27. llSetStatus(STATUS_PHYSICS, FALSE);
  28. llStopAnimation("recline sit");
  29. llMessageLinked(LINK_SET, 0, "unseated", "");
  30. llStopSound();
  31. llReleaseControls();
  32. sit = FALSE;
  33. listenState(FALSE);
  34. }
  35. else if (message == "pilot" & id != NULL_KEY) // id, means they sat
  36. {
  37. // Avatar gets on vehicle
  38. pilot = id ;
  39. sit = TRUE;
  40. llRequestPermissions(pilot, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
  41. listenState(TRUE);
  42. llWhisper(0,"Comanche Pilot, "+llKey2Name(pilot)+", with your HUD attached, Select Start Engine to begin Flight, type help for additional assistance.");
  43. llMessageLinked(LINK_SET, 0, "seated", "");
  44. }
  45. // more ifs and code can go here to detect other link message
  46. }
  47. }