Failing zcmd + sscanf.. help?
#2

pawn Код:
CMD:aheal(playerid, params[])
{
    new targetid, Float:health, targetname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[70], string2[70];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "This command is only for administrators!");
    if(sscanf(params,"ui", targetid, health)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /aheal [playerid/partofname] [health]");
    if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid player ID!");
    SetPlayerHealth(targetid, health);
    GetPlayerName(targetid, targetname, sizeof(targetname));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    format(string, sizeof(string), "You've set %s's (%d) health to %d.", targetname, targetid, health);
    SendClientMessage(playerid,COLOR_WHITE,string);
    format(string2, sizeof(string2), "%s has set your health to %d.", adminname, health);
    return SendClientMessage(targetid,COLOR_WHITE,string2);
}
health is not "r" player but integer ( a number).
Edit: I added the adminname you forgot it and in the last line it will send the Rcon Admin's ID.
Reply


Messages In This Thread
Failing zcmd + sscanf.. help? - by Region123 - 02.01.2012, 15:27
Re: Failing zcmd + sscanf.. help? - by Konstantinos - 02.01.2012, 15:31
Re: Failing zcmd + sscanf.. help? - by Region123 - 02.01.2012, 15:34
Re: Failing zcmd + sscanf.. help? - by Mokerr - 02.01.2012, 15:35
Re: Failing zcmd + sscanf.. help? - by Region123 - 02.01.2012, 15:38
Re: Failing zcmd + sscanf.. help? - by Danyal - 02.01.2012, 15:42
Re: Failing zcmd + sscanf.. help? - by Konstantinos - 02.01.2012, 15:44
Re: Failing zcmd + sscanf.. help? - by Region123 - 02.01.2012, 15:45
Re: Failing zcmd + sscanf.. help? - by Danyal - 02.01.2012, 15:47

Forum Jump:


Users browsing this thread: 1 Guest(s)