2 commands at one?!? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 commands at one?!? (
/showthread.php?tid=245391)
2 commands at one?!? -
pliptm - 31.03.2011
Hi.
I want to open/close a gate with ONE command, how it's possible?
This is cmd what open gate.
Код:
if (strcmp("/vдrav", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000)
}
return 1;
}
This is cmd what close the gate.
Код:
if (strcmp("/vдravc", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000)
}
return 1;
}
Can anybody help me?
Re: 2 commands at one?!? -
ronnie3148 - 31.03.2011
Код:
if (strcmp("/vдrav", cmdtext, true, 10) == 0)
{
GetPlayerName(playerid,pName,64);
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000)
SetTimer("CloseGate", 8000, 0);//we set the timer to run the function CloseGate in 8 seconds
}
return 1;
}
public CloseGate()
{
MoveDynamicObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000);
return 1;
}
dont forget to forward the function
Код:
forward CloseGate();
btw next time there are tons of tutorials use search
Re: 2 commands at one?!? -
iggy1 - 31.03.2011
pawn Код:
new bool:GateOpen;
if ( !strcmp("/vдrav", cmdtext, true ))
{
GetPlayerName(playerid,pName,64);
if( GateOpen )
{
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,75.35000000,2.00000000);
GateOpen = false;
}
}
else
{
if(!strcmp(pName,"Steven_Hayen2",true))
{
MoveObject(gate, 321.35000000,-1188.19000000,70.52000000,1.00000000);
GateOpen = true;
}
}
return 1;
}
Or use the code posted by ronnie3148 for auto close.
Re: 2 commands at one?!? -
pliptm - 31.03.2011
Big big thanks to you!
Re: 2 commands at one?!? -
pliptm - 31.03.2011
To iggy1: When i type this command /vдrav then gates goes down, but if i'm entering this cmd again, gate won't come up.. what's wrong?
Re: 2 commands at one?!? -
ronnie3148 - 01.04.2011
just use mine it works.