commands not works :(
#20

1. For /akill
pawn Code:
COMMAND:akill(playerid, params[])
{
    new toplayerid, reason[64], message[128];
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "only admins can use this command!");
    if(sscanf(params, "ds[64]", toplayerid, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /akill <plaerid> <reason>");
    if(toplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "that player is not connected");
    SetPlayerHealth(playerid, 0);
    format(message, sizeof(message), "Admin killed u reason : %s", reason);
    SendClientMessage(toplayerid, 0x00FF00FF, message);
    return 1;
}
2. For /sethealth
pawn Code:
COMMAND:sethealth(playerid, params[])
{
    new pID, amount, aName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME], string[256];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "[ERROR]:You need to be an Admin to Access this Commands!");
    if(sscanf(params, "dd", pID, Amount)) return SendClientMessage(playerid, COLOR_WHITE, "[CMD]:/sethealth [PlayerID] [Amount]");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid ,COLOR_BRIGHTRED,"[ERROR]:Player not Found!");
    GetPlayerName(playerid, aName, sizeof(aName));
    GetPlayerName(pID, pName, sizeof(pName));
    //format(string, sizeof(string),"Admin Has Healed You", aName, pName, Amount); //You can do this with SendClientMessage, aName, pName, Amount will be useless.
    format(string, sizeof(string),"Admin %s Has Set %s's Health to %d", aName, pName, Amount); //Admin "playerid" has set "pID" Health to "Amount"
    SendClientMessage(playerid, COLOR_BRIGHTRED, string); //Sends the message to playerid who uses the command
    SendClientMessage(pID, COLOR_BRIGHTRED, string); //Sends the message to target playerid (aka pID)
    SetPlayerHealth(pID, Amount); //Sets pID health to Amount
    return 1;
}
- On SetPlayerHealth, you don't need %s to set the playerhealth. the %s already stored in "Amount"
- %s is for string, %d or %i is for integer.
Reply


Messages In This Thread
sscanf and zcmd (akill command) [REP ++] - by SamiHam - 12.07.2012, 14:47
Re: commands not works :( - by UnknownGamer - 12.07.2012, 15:49
Re: commands not works :( - by SamiHam - 12.07.2012, 16:00
Re: commands not works :( - by SamiHam - 13.07.2012, 06:43
Re: commands not works :( - by Kaperstone - 13.07.2012, 07:41
Re: commands not works :( - by SamiHam - 13.07.2012, 08:25
Re: commands not works :( - by Pro_Scriptor - 13.07.2012, 09:00
Re: commands not works :( - by clarencecuzz - 13.07.2012, 09:55
Re: commands not works :( - by SamiHam - 13.07.2012, 09:58
Re: commands not works :( - by Devilxz97 - 13.07.2012, 11:21
Re: commands not works :( - by Devilxz97 - 13.07.2012, 11:59
Re: commands not works :( - by SamiHam - 13.07.2012, 12:05
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:16
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:39
Re: commands not works :( - by SamiHam - 13.07.2012, 12:52
Re: commands not works :( - by Devilxz97 - 13.07.2012, 12:58
Re: commands not works :( - by SamiHam - 13.07.2012, 13:01
Re: commands not works :( - by Devilxz97 - 13.07.2012, 13:12
Re: commands not works :( - by Devilxz97 - 13.07.2012, 13:58
Re: commands not works :( - by Andi_Evandy - 13.07.2012, 14:06

Forum Jump:


Users browsing this thread: 2 Guest(s)