How to create a /setkills and /setdeaths command?
#1

This is used for adding 1 more kill (It's on OnPlayerDeath).

PlayerInfo[playerid][Deaths]++;
// +1 Death when getting killed.

PlayerInfo[killerid][Kills]++;
// +1 Kill when killing someone

I want a command were I can do /SetKills [PlayerID] [Kills] and /SetDeaths [PlayerID] [Deaths] but I don't know how to make it :/

By the way!
I am using ZCMD

EDIT:

I tried editing a command I already had that I thought was almost the same (/SetScore) but it didn't work this is how it looks:

pawn Код:
CMD:setkills(playerid,params[]) {
 if(PlayerInfo[playerid][Level] >= 5) {
        new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setkills [playerid] [kills]");
        new player1 = strval(tmp), Kills = strval(tmp2), string[128];
        if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            CMDMessageToAdmins(playerid,"SetKills");
            format(string, sizeof(string), "You have set \"%s's\" kills to '%d' ", pName(player1), Kills); SendClientMessage(playerid,blue,string);
            if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your kills to '%d'", pName(playerid), Kills); SendClientMessage(player1,blue,string); }
            return PlayerInfo[player1, Kills);
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Only different was that I changed
pawn Код:
return SetPlayerScore(player1, score);
to
pawn Код:
return PlayerInfo[player1, Kills);
Reply


Messages In This Thread
How to create a /setkills and /setdeaths command? - by OleKristian95 - 19.05.2012, 00:54
Re: How to create a /setkills and /setdeaths command? - by Paramount - 19.05.2012, 01:04
Re: How to create a /setkills and /setdeaths command? - by [ABK]Antonio - 19.05.2012, 01:05
Re: How to create a /setkills and /setdeaths command? - by Paramount - 19.05.2012, 01:08
Re: How to create a /setkills and /setdeaths command? - by OleKristian95 - 19.05.2012, 01:09

Forum Jump:


Users browsing this thread: 1 Guest(s)