04.08.2014, 22:07
When I type the command ingame like this "/sethp" it returns "ERROR: Player is not connected" and when I type an ID it returns "Server: Unknown Command". What is the problem here?
This is my command:
This is my command:
pawn Код:
if(strcmp("/sethp", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, -1, "USAGE: /sethp [playerid/PartOfName] [health]");
new playa;
new health;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
health = strval(tmp);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new playername[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, playername, sizeof(playername));
SetPlayerHealthAM(playa, health);
format(string, sizeof(string), "Your health has been set to %d by %s (%d)", health, playername, playerid);
SendClientMessage(playerid, -1, string);
}
else
return SendClientMessage(playerid, -1, "{FF0000}ERROR: Player is not connected!");
}
else
return SendClientMessage(playerid, -1, "{FF0000}ERROR: Player is not connected!");
}
return 1;
}