17.07.2011, 23:18
Hello guys, I've a "little" problem with my getstat fonction.. I've created it afternoon, it work perferctley but... only on me. I explain, if I make /getstats ID of a player connecting, I've always, my stats, and not his stats.. Someone can help me? Here the code:
Thank's.
pawn Код:
COMMAND:getstats(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 2)
{
new tmp[MAX_STRING];
new Index;
tmp = strtok(params, Index);
new id = strval(tmp);
if(isnull(tmp))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /getstats <ID>");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
new string[128];
new stringB[128];
new stringC[128];
new stringD[128];
new stringE[128];
new stringF[128];
new stringG[128];
new stringH[128];
new stringI[128];
new stringJ[128];
new pName[MAX_PLAYER_NAME];
new pip[16];
new Float:ratio;
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(file, sizeof(file), "/Accounts/%s.ini", pName);
PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
PlayerInfo[playerid][Deaths] = dini_Int(file, "Deaths");
PlayerInfo[playerid][Warns] = dini_Int(file, "Warns");
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][Credit] = dini_Int(file, "Credit");
PlayerInfo[playerid][VIP] = dini_Int(file, "VIP");
ratio = floatdiv(PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]);
GetPlayerIp(playerid, pip, sizeof(pip));
format(stringB, 128, "Name : %s", pName);
SendClientMessage(playerid, COLOR_WHITE, stringB);
format(string, 128, "PlayerIP: %s", pip);
SendClientMessage(playerid, COLOR_WHITE, string);
format(stringC, 128, "Score: %d", GetPlayerScore(playerid));
SendClientMessage(playerid, COLOR_WHITE, stringC);
format(stringD, 128, "Kills: %i", PlayerInfo[playerid][Kills]);
SendClientMessage(playerid, COLOR_WHITE, stringD);
format(stringE, 128, "Deaths: %i", PlayerInfo[playerid][Deaths]);
SendClientMessage(playerid, COLOR_WHITE, stringE);
format(stringF, 128, "Ratio: %f", ratio);
SendClientMessage(playerid, COLOR_WHITE, stringF);
format(stringG, 128, "Warns: %i", PlayerInfo[playerid][Warns]);
SendClientMessage(playerid, COLOR_WHITE, stringG);
format(stringH, 128, "AdminLevel: %i", PlayerInfo[playerid][AdminLevel]);
SendClientMessage(playerid, COLOR_WHITE, stringH);
format(stringI, 128, "Credits: %i", PlayerInfo[playerid][Credit]);
SendClientMessage(playerid, COLOR_WHITE, stringI);
format(stringJ, 128, "VIP: %i", PlayerInfo[playerid][VIP]);
SendClientMessage(playerid, COLOR_WHITE, stringJ);
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
}