17.02.2013, 22:49
I've made this command here
It works fine the first time I use it (first time opens it), but the second time it does nothing. If I add for example +1 to GateInfo[i][gPosZ], it goes 1 up, the same with gStatus.
pawn Код:
CMD:gate(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gate [pass]");
for(new i = 0; i < sizeof(GateInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, GateInfo[i][gPosX], GateInfo[i][gPosY], GateInfo[i][gPosZ]))
{
if(strval(params) == GateInfo[i][gPassword])
{
if(GateInfo[i][gStatus] == 0)
{
MoveObject(GateInfo[i][gObject], GateInfo[i][gPosXM], GateInfo[i][gPosYM], GateInfo[i][gPosZM], GateInfo[i][gSpeed]);
GateInfo[i][gStatus] = 1;
}
else
{
MoveObject(GateInfo[i][gObject], GateInfo[i][gPosX], GateInfo[i][gPosY], GateInfo[i][gPosZ], GateInfo[i][gSpeed]);
GateInfo[i][gStatus] = 0;
}
}
else return SendClientMessage(playerid, COLOR_GREY, "Incorrect password.");
}
}
return 1;
}