27.03.2016, 11:07
The best attempt would be to use you existing code
You load the data from the file into an unused PlayerInfo cell and call ShowStats with the cell
The loading code should be somewhere in your login system, extract that into a function so you can call it individually
Example
You load the data from the file into an unused PlayerInfo cell and call ShowStats with the cell
The loading code should be somewhere in your login system, extract that into a function so you can call it individually
Example
PHP код:
IRP:check(playerid, var[])
{
if(!Logged(playerid)) {
return NoLogin(playerid);
if(Player[playerid][pAdmin] < 2 && Player[playerid][pStaffObserver]) {
return NoAuth(playerid);
}
new
name[MAX_PLAYER_NAME]
;
if(sscanf(var,"s[24]s[128]", name, var)) {
SendClientMessage(playerid, COLOR_WHITE, "{00BFFF}Usage:{FFFFFF} /check [name] [checks]");
return SendClientMessage(playerid, COLOR_GRAD2, "** [CHECKS]: stats");
}
if(!strcmp(var, "stats", true)) {
new
user
;
sscanf(name, "u", user);
// not connected or not logged
if(user == INVALID_PLAYER_ID || !Logged(user)) {
user = sizeof PlayerInfo - 1; // last cell - probably unused
if(IsPlayerConnected(user)) { // to be sure check if the player is connected
return SendClientMessage(playerid, COLOR_GRAD2, "** Command unavailable at the moment :p");
} // to avoid the IsPlayerConnect check /\ increase PlayerInfo by 1
// (new PlayerInfo[MAX_PLAYERS + 1][pInfo])
if(!LoadPlayerInfo(user, name)) { // loading function which normally gets called after login
return SendClientMessage(playerid, COLOR_GRAD2, "** Playername not found!");
} // if the loading failed to due an invalid playername /\
}
ShowStats(playerid, user);
}
return true;
}