I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
Ok, i made my gate but i have to make 2 cmds, 1 to open the gate, and another to close the gate, can anyone show me how to use 1 cmd to open and close gate.
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
Voldemort - 07.09.2010
You could use timer to close gates automaticly or
on top
new GatesOpen;
in cmd
if(GatesOpen == 0)
{
GatesOpen = 1;
Open
}
else
{
Close
GatesOpen = 0;
}
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
OK i will try to add it, and will i have or use 2 or 1 cmds?
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
[UG]Scripter - 07.09.2010
If you use a timer like I did, 1 cmd.
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
I dont want to use timers, i want gate to open manually.
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
Sorry to double post, here is my code, but i cant seem to get it working, can u add it for me.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/gateopen", cmdtext, true, 10) == 0)
{
MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
return 1;
}
if (strcmp("/gateclose", cmdtext, true, 10) == 0)
{
MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
return 1;
}
else
{
SendClientMessage(playerid,0xFF0000FF,"You are too far to open the gate");
return 0;
}
}
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
PinkFloydLover - 07.09.2010
pawn Код:
if (!strcmp("/gateclose", cmdtext, true))
{
if(IsPlayerInRangeOfPoint(playerid,5,2706.0078125, 652.048828125, 11.070308685303);
{
MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
}
else
{
SendClientMessage(playerid,0xFF0000FF,"You are too far to open the gate");
return 1;
}
}
there you go

, thats for the /gateclose command do the same with the gate open one to
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
Cale, my gate commands are working, i just want to reduce it to 1 command (i want 1 command that will open and close the gate)
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
iggy1 - 07.09.2010
Like Voldemort said somthing like this.
pawn Код:
new gOpen;//top with other global variables
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/gateopen", cmdtext, true, 10) == 0)//change this command to gate?
{
if(gOpen == 1)
{
gOpen = 0;
MoveObject(mygate,2706.0078125, 652.048828125, 11.070308685303,3.0);
SendClientMessage(playerid,0xFFFF00FF,"You have just closed the Yard gate");
return 1;
}
else
{
gOpen = 1;
MoveObject(mygate,2705.8347167969, 657.30255126953, 11.070308685303,3.0);
SendClientMessage(playerid,0xFFFF00FF,"You have just opened the Yard gate");
}
}
return 0;
}
Re: I need a teacher (how to use 1 cmd to make 2 things move) -
zack3021 - 07.09.2010
ok Thanks guys it worked.