07.09.2010, 07:32
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.
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;
}
}
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;
}
}
, thats for the /gateclose command do the same with the gate open one to
new gOpen;//top with other global variables
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;
}