Make KDR
#1

how to add KDR in /stats?
pawn Код:
CMD:stats (playerid, params[])
{
    new str[400], second[400], giveid, AdminRank[30], weaponset[30];
    if (sscanf(params, "u", giveid)) return SendClientMessage(playerid, 0x6FFF00FF, "{F07F1D}USAGE: {BBFF00}/stats <ID>" );
    if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Invalid player ID!");
    switch (PlayerInfo[giveid][Admin])
    {
        case 0: AdminRank = "Regular Player";
        case 1: AdminRank = "{15C257}Moderator";
        case 2: AdminRank = "{EDD628}Administrator";
        case 3: AdminRank = "{3D77F5}Head Administrator";
        case 4: AdminRank = "{F55F3D}Server Owner";
    }
    switch (PlayerInfo[giveid][WeaponSet])
    {
        case 0: weaponset = "Standard";
        case 1: weaponset = "Advanced";
        case 2: weaponset = "Expert";
        case 3: weaponset = "Custom";
    }
    format(str, sizeof(str), "{%06x}%s(%d) "RED"|| {FCFFC3}Statistics:\n\n{6EAAFF}> Member since: "STEELBLUE"%s\n{6EAAFF}> Status: "STEELBLUE"%s\n{6EAAFF}> Online Time: "STEELBLUE"%d hours and %d minutes\n", (GetPlayerColor(giveid) >>> 8), GetName(giveid), giveid, PlayerInfo[giveid][RegOn], AdminRank, PlayerInfo[giveid][Hours], PlayerInfo[giveid][Minutes]);
    format(second, sizeof(second), "{6EAAFF}> Score: "STEELBLUE"%d\n{6EAAFF}> Cash: "STEELBLUE"$%d\n{6EAAFF}> Kills: "STEELBLUE"%d\n{6EAAFF}> Deaths: "STEELBLUE"%d\n{6EAAFF}> Weapon Set: "STEELBLUE"%s\n", GetPlayerScore(giveid), GetPlayerMoney(giveid), PlayerInfo[giveid][Kills], PlayerInfo[giveid][Deaths], weaponset);
    strcat(str, second);
    ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "{21A6FF}Statistics", str, "OK", "");
    return 1;
}
Reply
#2

In statistics, ratio = mean (mean/mode/median).
So basically you'd have to sum up the kill+death then divide it by the amount of kill one player has.
Reply
#3

Quote:
Originally Posted by Cannary2048
Посмотреть сообщение
In statistics, ratio = mean (mean/mode/median).
So basically you'd have to sum up the kill+death then divide it by the amount of kill one player has.
What You're talking about 'average', that's a completely different thing.

ratio = kills / deaths

Therefore,
pawn Код:
new Float:KillDeathRatio;
if(PlayerInfo[giveid][Deaths] != 0) KillDeathRatio = PlayerInfo[giveid][Kills] / PlayerInfo[giveid][Deaths];
//Deaths must not be equal to 0, as you cannot divide by 0.
Reply
#4

You're talking about KillDeath Ratio or?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)