pstats cmd bugged
#1

When i type /pstats 1 it's showing wrong stats.. :S then i type /pstats 2 and it will be showing /pstats 1 stats.. :S
pawn Код:
dcmd_pstats(playerid,params[])
{
    new statid;
    new string[256];
  new Float:ratio=floatdiv(UserUD[statid][kills], UserUD[statid][deaths]);

    if(sscanf(params, "u", statid)) return SendClientMessage(playerid,green,"Error: /pstats <playerid/name>");
    if(!IsPlayerConnected(statid) || statid == INVALID_PLAYER_ID || statid == playerid) return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself, For your own stats use /stats");

  format(string,sizeof(string),"Duty-Stats: Kills: %d | Deaths: %d | KD Ratio: %.2f | Admin Level: %d | Duty-ViP: %d | Duty-Cash: %d",UserUD[statid][kills],UserUD[statid][deaths],ratio,UserUD[statid][admin],UserUD[statid][vip],UserUD[statid][money]);
    SendClientMessage(playerid,green,string);
  format(string,sizeof(string),"Duty-Special-Stats: cookies: %d",UserUD[statid][cookies]);
    SendClientMessage(playerid,green,string);
    return 1;
}
I hope somebody is able to help.
Reply
#2

This line "new Float:ratio=floatdiv(UserUD[statid][kills], UserUD[statid][deaths]);" should be under "if(sscanf...". Everything else looks correct...

pawn Код:
dcmd_pstats(playerid,params[])
{
    new statid;
    new string[256];

    if(sscanf(params, "u", statid)) return SendClientMessage(playerid,green,"Error: /pstats <playerid/name>");
    if(!IsPlayerConnected(statid) || statid == INVALID_PLAYER_ID || statid == playerid) return SendClientMessage(playerid,green,"Error: Player is not connected or it is yourself, For your own stats use /stats");
  new Float:ratio=floatdiv(UserUD[statid][kills], UserUD[statid][deaths]);

  format(string,sizeof(string),"Duty-Stats: Kills: %d | Deaths: %d | KD Ratio: %.2f | Admin Level: %d | Duty-ViP: %d | Duty-Cash: %d",UserUD[statid][kills],UserUD[statid][deaths],ratio,UserUD[statid][admin],UserUD[statid][vip],UserUD[statid][money]);
    SendClientMessage(playerid,green,string);
  format(string,sizeof(string),"Duty-Special-Stats: cookies: %d",UserUD[statid][cookies]);
    SendClientMessage(playerid,green,string);
    return 1;
}
Reply
#3

k thanks
Reply
#4

Код:
!IsPlayerConnected(statid) || statid == INVALID_PLAYER_ID
Useless. Use only second option.
Код:
statid == INVALID_PLAYER_ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)