04.08.2014, 22:37
I don't know how to use sscanf and y_cmd etc..
Okay I deleted one of the strtok's and when not inserting any numbers, it returns the USAGE message I wrote like should. Now the problem is when you insert an id and then it still returns "Server: Unknown Command"
Okay I deleted one of the strtok's and when not inserting any numbers, it returns the USAGE message I wrote like should. Now the problem is when you insert an id and then it still returns "Server: Unknown Command"
pawn Код:
if(strcmp("/sethp", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid))
{
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;
}