17.02.2013, 15:10
pawn Код:
CMD:gate(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gate [password]");
new string[128];
new iName[24], gate = -1;
GetPlayerName(playerid, iName, 24);
for(new i = 0; i != MAX_GATES; i++ )
if(GateInfo[i][gCreated] == 1)
if(strval(params) == GateInfo[i][gPassword])
{
gate = i; break;
}
if(gate != -1)
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ]))
{
if(GateInfo[gate][gStatus] == GATE_CLOSED)
{
MoveObject(GateInfo[gate][gObject], GateInfo[gate][gXM], GateInfo[gate][gYM], GateInfo[gate][gZM], GateInfo[gate][gSpeed]);
format(string, sizeof(string), "* %s uses their remote control to open the gate.", iName);
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
}
else
{
MoveObject(GateInfo[gate][gObject], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ], GateInfo[gate][gSpeed]);
format(string, sizeof(string), "* %s uses their remote control to close the gate.", iName);
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not near any gate!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Incorrect password!");
return 1;
}
return 1;
}