/gate command, and only /gate -
Omega90210 - 28.04.2009
Hi there, I am looking if anyone can give me any help for a /gate command that would open AND close gates/barriers, I dont want to have to use LSPDBarrier1open/close that is stupid, ive been in servers where you just have to have a hotkey(well i do anyway)of /gate, and the command opens and closes the barriers/gates, I have down the requirements on if the player is connected, IsAcop/admin what not, just need help on how to check for one, to see if the person is like actually near the gate, and two, checking whether or not /gate opens or closes, meaning how do i check to see if the gate is already open or closed when /gate is entered, to choose whether to close or open...hope this isnt confusing..thank you and here is what i have so far:
Код:
if(strcmp(cmd, "/gate", true) == 0) // Command
{
if(IsACop(playerid) || PlayerInfo[playerid][pAdmin] >= 1) // Checks if the player is in the police
{
if(ProxDetectorS(11.0, playerid, LSPDBarrier1) && GetObjectPos(LSPDBarrier1,0.000000,89.000000,269.818847))
{
SetObjectRot(LSPDBarrier1,0.000000,0.000000,269.818847); // Moves the object
SetTimer("LSPDBarrier1Timer", 5000, 0);
GameTextForPlayer(playerid, "~w~Access ~g~Granted", 5000, 4);
}
else if(ProxDetectorS(11.0, playerid, LSPDBarrier1) && GetObjectPos(LSPDBarrier1,0.000000,0.000000,269.818847))
{
SetObjectRot(LSPDBarrier1,0.000000,89.000000,269.818847);
}
else if(strcmp(cmd, "/gate", true) == 0)
{
if(IsACop(playerid) || PlayerInfo[playerid][pAdmin] >= 1 && ProxDetectorS(11.0, playerid, LSPDGate1))
{
MoveObject(LSPDGate1, 1588.265991,-1638.143554,9.534472,1.0);
SetTimer("LSPDGate1Timer", 5000, 0);
}
}
else if(strcmp(cmd, "/gate", true) == 0)
{
if(IsACop(playerid) || PlayerInfo[playerid][pAdmin] >= 1 && ProxDetectorS(11.0, playerid, LSPDGate1))
{
MoveObject(LSPDGate1, 1588.265991,-1638.143554,15.014236,0.9);
Re: /gate command, and only /gate -
MenaceX^ - 28.04.2009
Why are you making three commands?
Re: /gate command, and only /gate -
HB - 28.04.2009
Use bools, then check the bool (1 is open, 0 is closed for example). When the bool is 0 you open the gate and set the bool to 1
Re: /gate command, and only /gate -
MenaceX^ - 28.04.2009
Or GetObjectPos.
Re: /gate command, and only /gate -
HB - 28.04.2009
Quote:
Originally Posted by MenaceX^
Or GetObjectPos.
|
That would get bugged when you spam the command.
Re: /gate command, and only /gate -
silvan - 28.04.2009
use OnPlayerKeyStateChange..
Re: /gate command, and only /gate -
MenaceX^ - 28.04.2009
Quote:
Originally Posted by silvan
use OnPlayerKeyStateChange..
|
Why should he? Do you even know what does OnPlayerKeyStateChange do?
Quote:
Originally Posted by иєσz
Quote:
Originally Posted by MenaceX^
Or GetObjectPos.
|
That would get bugged when you spam the command.
|
Players shouldn't spam in commands.
Re: /gate command, and only /gate -
Omega90210 - 29.04.2009
Quote:
Originally Posted by иєσz
Use bools, then check the bool (1 is open, 0 is closed for example). When the bool is 0 you open the gate and set the bool to 1
|
I must appologize, in all my months of scripting, i never heard the term bools, would it be possible for someone to show me an example of what he is talking about, or better yet, just throw together a script please...Thank you
Re: /gate command, and only /gate -
RatZ - 25.06.2009
where i should copy that code