The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with script for "3 levers to unlock a door"
Mackiiboy Offline
Member

Posts: 101
Threads: 7
Joined: Jan 2012
Reputation: 11
#1
Help with script for "3 levers to unlock a door"

I have a problem with my script. I'm trying to use a script there 3 levers are needed to be pulled down to unlock a door. When I'm using one of the levers, the door unlocks before I've pulled down the two other levers.
I have no idea what's wrong with my script. If you can find what's wrong, please make a comment [Image: shy.gif].



void OnStart()
{
//-- Leversfunction
SetLocalVarInt("Var_sum1", 0);
SetEntityConnectionStateChangeCallback("lever1", "func_lever1");
SetEntityConnectionStateChangeCallback("lever2", "func_lever2");
SetEntityConnectionStateChangeCallback("lever3", "func_lever3");
}



// -- Levers - open door

void func_lever1(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var_sum1", 1);
Func_open_gate();
}
}

void func_lever2(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var_sum1", 1);
Func_open_gate();
}
}

void func_lever3(string &in asEntity, int alState)
{
if (alState == 1)
{
AddLocalVarInt("Var_sum1", 1);
Func_open_gate();
}
}

void Func_open_gate()
{
if(GetLocalVarInt("Var_sum1") == 3)
{
SetSwingDoorLocked("prison_cellardoor", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_cellardoor", 0, false);
GiveSanityBoostSmall();
}
}
(This post was last modified: 01-30-2012, 08:06 AM by Mackiiboy.)
01-29-2012, 03:28 PM
Website Find


Messages In This Thread
Help with script for "3 levers to unlock a door" - by Mackiiboy - 01-29-2012, 03:28 PM



Users browsing this thread: 1 Guest(s)