21.07.2012, 16:08
hello, i made a command (/break) and you have to be near the person to execute the command but it seems that it tells me im never near the person.
pawn Код:
CMD:break(playerid, params[])
{
new id, idcar, string[128], string2[128];
if(gTeam[playerid] == MECHANIC)
{
if(PlayersDistance(playerid, id) > 5)
{
if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, "USAGE: /break <id/name>");
idcar = GetPlayerVehicleID(id);
SetVehicleHealth(idcar, 20);
format(string, sizeof(string), "You have broken %s car by filling it with sand", PlayerName(id));
format(string2, sizeof(string2), "%s has filled your engine with sand! get out!", PlayerName(playerid));
SendClientMessage(playerid, -1, string);
SendClientMessage(id, -1, string2);
SetPlayerWantedLevel(playerid, 4);
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player is not connected");
if(id == playerid) return SendClientMessage(playerid, -1, "You cant use this command on youself");
return 1;
}
else if(PlayersDistance(playerid, id) < 5)
{
new string3[128];
format(string3, sizeof(string3), "You are not close enough to %s", PlayerName(id));
SendClientMessage(playerid, -1, string3);
return 1;
}
}
return 1;
}