18.07.2011, 00:45
PHP код:
COMMAND:getstats(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] < 2) return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
new tmp[256], idx;
tmp = strtok(params, idx);
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], pName[MAX_PLAYER_NAME], pip[16];
GetPlayerName(id, pName, MAX_PLAYER_NAME);
format(file, sizeof(file), "/Accounts/%s.ini", pName);
GetPlayerIp(id, pip, sizeof(pip));
format(string, 128, "Name : %s", pName);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "PlayerIP: %s", pip);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Score: %d", GetPlayerScore(id));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Kills: %i", dini_Int(file, "Kills"));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Deaths: %i", dini_Int(file, "Deaths"));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Ratio: %f", floatdiv(PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths]));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Warns: %i", dini_Int(file, "Warns"));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "AdminLevel: %i", dini_Int(file, "AdminLevel"));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "Credits: %i", dini_Int(file, "Credit"));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, 128, "VIP: %i", dini_Int(file, "VIP"));
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}