[Help] Stats
#1

Hey all i made stats command and it work fine but problem is when player e.g. id 0 left server,and other player join server and get id 0, when i do /stats 0 it still showing stats for player who left with id 0?

Anyone know how to fix that?

Here is command if you need something else from code tell me:
pawn Код:
CMD:stats(playerid,params[])
{
    new name[MAX_PLAYER_NAME];
    new id;
    if(sscanf(params,"d",id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /stats <ID>");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
    new string[128];
    GetPlayerName(id, name, sizeof(name));
    new Float:ratio=floatdiv(PlayerInfo[id][pKills], PlayerInfo[id][pDeaths]);
    format(string, 128, "%d %d %.2f", PlayerInfo[id][pKills], PlayerInfo[id][pDeaths], ratio);
    format(string, sizeof(string), "Name: %s (ID:%d)\nKills : %d\nDeaths : %d\nKill/Death Ratio: %.2f\nScore: %d\nTime Played: %d Hours, %d Minutes, %d Seconds",name, id, PlayerInfo[id][pKills], PlayerInfo[id][pDeaths], ratio,PlayerInfo[id][pScore],PlayerInfo[id][pHour],PlayerInfo[id][pMin],PlayerInfo[id][pSec]);
    ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Player Stats",string,"Close","");
    return 1;
}
Reply


Messages In This Thread
[Help] Stats - by NeamPojma - 23.06.2015, 11:35
Re: [Help] Stats - by shadowdog - 23.06.2015, 12:41

Forum Jump:


Users browsing this thread: 1 Guest(s)