Command /setkills how i should make it?
#7

Example code, learn from this so in the future when you need help, post the problem you have with the code that you currently have otherwise dont expect help.

pawn Код:
enum P_DATA {
    pKills,
    pDeaths
}
new pInfo[MAX_PLAYERS][P_DATA]; /* Hooking pInfo to player and some P_DATA so we can use pInfo[playerid][pKills] += 1; etc. */

public OnPlayerDeath(playerid, killerid, reason)
{
    pInfo[playerid][pDeaths] += 1; //adding 1 death to players deaths

    if(killerid != INVALID_PLAYER_ID) { //if the killer exists, making sure player didnt die by falling, admin killed etc.
        pInfo[killerid][pKills] += 1; //adding 1 more kill to the killer
        new string[64];
        format(string,sizeof(string),"You have %i kills in total",pInfo[killerid][pKills]);
        SendClientMessage(killerid,COLOR_GREEN,string);
    }
    return 1;
}

CMD:addkills(playerid,params[]) {
    new kills;
    if(sscanf(params,"i",kills)) return SendClientMessage(playerid,COLOR_RED,"Usage: /addkills [kills]");
    pInfo[playerid][pKills] += kills; //adds to current kills
    return true;
}
Reply


Messages In This Thread
Command /setkills how i should make it? - by henkas - 18.11.2016, 14:57
Re: Command /setkills how i should make it? - by iLearner - 18.11.2016, 14:58
Re: Command /setkills how i should make it? - by henkas - 18.11.2016, 15:09
Re: Command /setkills how i should make it? - by Dayrion - 18.11.2016, 15:33
Re: Command /setkills how i should make it? - by henkas - 18.11.2016, 15:36
Re: Command /setkills how i should make it? - by Sew_Sumi - 18.11.2016, 16:07
Re: Command /setkills how i should make it? - by TwinkiDaBoss - 18.11.2016, 16:48

Forum Jump:


Users browsing this thread: 1 Guest(s)