Advertisement
Guest User

Untitled

a guest
Dec 13th, 2011
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. void OnStart()
  2. {
  3.     SetEntityConnectionStateChangeCallback("lever_1", "storeCheckLeverState");
  4.     SetEntityConnectionStateChangeCallback("lever_2", "storeCheckLeverState");
  5.     SetEntityConnectionStateChangeCallback("lever_3", "storeCheckLeverState");
  6.     SetEntityConnectionStateChangeCallback("lever_4", "storeCheckLeverState");
  7.     SetEntityConnectionStateChangeCallback("lever_5", "storeCheckLeverState");
  8.     SetEntityConnectionStateChangeCallback("lever_6", "storeCheckLeverState");
  9.     SetEntityConnectionStateChangeCallback("lever_7", "storeCheckLeverState");
  10.     SetEntityConnectionStateChangeCallback("lever_8", "storeCheckLeverState");
  11.  
  12.  
  13. }
  14.  
  15. void checkLeverStates()
  16. {
  17.     if (GetLocalVarInt("lever_1") == 1
  18.      && GetLocalVarInt("lever_2") == 1
  19.      && GetLocalVarInt("lever_3") == 1
  20.      && GetLocalVarInt("lever_4") == 1
  21.      && GetLocalVarInt("lever_5") == 1
  22.      && GetLocalVarInt("lever_6") == 1
  23.      && GetLocalVarInt("lever_7") == 1
  24.      && GetLocalVarInt("lever_8") == 1)
  25.     {
  26.         performLeverTaskCompleted();
  27.     }
  28. }
  29. void performLeverTaskCompleted()
  30. {
  31.     SetSwingDoorLocked("door1", false, false);
  32.     SetSwingDoorClosed("door1", false, false);
  33.     PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
  34.     PlaySoundAtEntity("", "quest_completed.snt", "Player", 0.5f, false);
  35.     StartEffectFlash(1, 0.4, 1);
  36.     SetLeverInteractionDisablesStuck("lever_*", false);//This will lock all the levers whose name starts with lever_
  37. }
  38.  
  39. void storeCheckLeverState(string &in entity, int state)
  40. {
  41.     SetLocalVarInt(entity, state);
  42.     SetLeverStuckState(entity, state, false);
  43.     SetLeverInteractionDisablesStuck(entity, true);
  44.     checkLeverStates();
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement