Kill Score based on Ranks
#2

pawn Код:
#define MAX_PLAYER_LEVELS 6
#define MAX_LEVELNAME_LEN 10

new const g_LevelXPLimit[MAX_PLAYER_LEVELS] = {
    500,
    1500,
    3500,
    6500,
    8000,
    12000
};

new const g_LevelKillReward[MAX_PLAYER_LEVELS] = {
    5,
    7,
    10,
    14,
    19,
    25
};

new const g_LevelNames[MAX_PLAYERS_LEVELS][MAX_LEVELNAME_LEN+1 char] = {
    !"Newbie",
    !"Novice",
    !"Apprentice",
    !"Adept",
    !"Expert",
    !"Master"
};

new g_PlayerXP[MAX_PLAYERS];

GetPlayerLevel(playerid) {
    for(new lvl; lvl < MAX_PLAYER_LEVELS ; lvl ++) {
        if( g_PlayerXP[playerid] < g_LevelXPLimit[lvl] ) {
            return lvl;
        }
    }
    return MAX_PLAYER_LEVELS - 1;
}

public OnPlayerDeath(playerid, killerid, reason) {
    if( killerid != INVALID_PLAYER_ID ) {
        new
            dead_lvl = GetPlayerLevel(playerid),
            dead_name[MAX_PLAYER_NAME+1],
            dead_lvl_name[MAX_LEVELNAME_LEN+1],
            msg_str[144+1]
        ;
       
        SetPlayerScore(killerid, GetPlayerScore(killerid) +  g_LevelKillReward[dead_lvl]); // added recently

        GetPlayerName(playerid, dead_name, sizeof dead_name);
        strunpack(dead_lvl_name, g_LevelNames[dead_lvl], sizeof dead_lvl_name);
        format(msg_str, sizeof msg_str, "Score +%i for killing %s (%s)!", g_LevelKillReward[dead_lvl], dead_name, dead_lvl_name);
        SendClientMessage(killerid, 0xFFFFFFFF, msg_str);
    }
    return 1;
}
Something like this?
Reply


Messages In This Thread
Kill Score based on Ranks - by Sting. - 25.02.2018, 10:46
Re: Kill Score based on Ranks - by RedFusion - 25.02.2018, 11:11
Re: Kill Score based on Ranks - by Sting. - 25.02.2018, 11:37
Re: Kill Score based on Ranks - by RedFusion - 25.02.2018, 11:43
Re: Kill Score based on Ranks - by Sting. - 25.02.2018, 12:32
Re: Kill Score based on Ranks - by AlexMSK - 25.02.2018, 12:36
Re: Kill Score based on Ranks - by rfr - 25.02.2018, 12:39
Re: Kill Score based on Ranks - by RedFusion - 25.02.2018, 12:41
Re: Kill Score based on Ranks - by Sting. - 25.02.2018, 13:49
Re: Kill Score based on Ranks - by RedFusion - 25.02.2018, 16:28

Forum Jump:


Users browsing this thread: 1 Guest(s)