Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnStart()
- {
- SetEntityConnectionStateChangeCallback("lever_1", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_2", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_3", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_4", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_5", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_6", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_7", "storeCheckLeverState");
- SetEntityConnectionStateChangeCallback("lever_8", "storeCheckLeverState");
- }
- void checkLeverStates()
- {
- if (GetLocalVarInt("lever_1") == 1
- && GetLocalVarInt("lever_2") == 1
- && GetLocalVarInt("lever_3") == 1
- && GetLocalVarInt("lever_4") == 1
- && GetLocalVarInt("lever_5") == 1
- && GetLocalVarInt("lever_6") == 1
- && GetLocalVarInt("lever_7") == 1
- && GetLocalVarInt("lever_8") == 1)
- {
- performLeverTaskCompleted();
- }
- }
- void performLeverTaskCompleted()
- {
- SetSwingDoorLocked("door1", false, false);
- SetSwingDoorClosed("door1", false, false);
- PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
- PlaySoundAtEntity("", "quest_completed.snt", "Player", 0.5f, false);
- StartEffectFlash(1, 0.4, 1);
- SetLeverInteractionDisablesStuck("lever_*", false);//This will lock all the levers whose name starts with lever_
- }
- void storeCheckLeverState(string &in entity, int state)
- {
- SetLocalVarInt(entity, state);
- SetLeverStuckState(entity, state, false);
- SetLeverInteractionDisablesStuck(entity, true);
- checkLeverStates();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement