23.09.2009, 20:56
I've got this stats command, and sometimes if you put someones id in, it'll return "Command not found".. Please help.
pawn Код:
dcmd_stats(playerid,params[])
{
new pName[24], PlayerFile[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerFile, sizeof(PlayerFile), "AdminScript/Users/%s.ini", pName);
pInfo[playerid][Deaths] = dini_Int(PlayerFile, "Deaths");
if(!pInfo[playerid][Logged])
{
SendClientMessage(playerid,COLOR_RED,"ERROR: You must be loggedin to view your stats.");
return 1;
}
if(params[0])
{
new giveplayerid = strval(params),string[128];
if(!IsPlayerConnected(giveplayerid))
{
SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid ID.");
return 1;
}
if(!pInfo[giveplayerid][Logged])
{
SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not logged in");
return 1;
}
if(giveplayerid == playerid)
{
format(string,128,"| Your Stats: | Kills: %d | Deaths: %d | Ratio: %d | Money: %d | Level: %d |",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][Kills] / pInfo[playerid][Deaths],GetPlayerMoney(playerid),pInfo[playerid][pLevel]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
format(string,128,"| Stats for %s: | Kills: %d | Deaths: %d | Ratio: %f | Money: %d | Level: %d |",ReturnPlayerName(giveplayerid),pInfo[giveplayerid][Kills],pInfo[giveplayerid][Deaths],pInfo[giveplayerid][Kills] / pInfo[giveplayerid][Deaths],GetPlayerMoney(giveplayerid),pInfo[giveplayerid][pLevel]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
else
{
new string[128];
format(string,128,"| Your Stats: | Kills: %d | Deaths: %d | Ratio: %f | Money: %d | Level: %d |",pInfo[playerid][Kills],pInfo[playerid][Deaths],pInfo[playerid][Kills] / pInfo[playerid][Deaths],GetPlayerMoney(playerid),pInfo[playerid][pLevel]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
}