/ocheck
#9

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
PHP код:
IRP:check(playerid, var[])
{
    if(!
Logged(playerid)) {
        return 
NoLogin(playerid);
    if(
Player[playerid][pAdmin] < && Player[playerid][pStaffObserver]) {
        return 
NoAuth(playerid);
    }
    new
        
name[MAX_PLAYER_NAME]
    ;
    if(
sscanf(var,"s[24]s[128]"name, var)) {
        
SendClientMessage(playeridCOLOR_WHITE"{00BFFF}Usage:{FFFFFF} /check [name] [checks]");
        return 
SendClientMessage(playeridCOLOR_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(playeridCOLOR_GRAD2"** Command unavailable at the moment :p");
            } 
// to avoid the IsPlayerConnect check /\ increase PlayerInfo by 1
            // (new PlayerInfo[MAX_PLAYERS + 1][pInfo])
            
if(!LoadPlayerInfo(username)) { // loading function which normally gets called after login
                
return SendClientMessage(playeridCOLOR_GRAD2"** Playername not found!");
            } 
// if the loading failed to due an invalid playername /\
        
}
        
ShowStats(playeriduser);
    }
    return 
true;

Reply


Messages In This Thread
/ocheck - by iKevin - 26.03.2016, 17:37
Re: /ocheck - by iKevin - 26.03.2016, 18:08
Re: /ocheck - by Karan007 - 26.03.2016, 18:15
Re: /ocheck - by iKevin - 26.03.2016, 18:17
Re: /ocheck - by Karan007 - 26.03.2016, 18:22
Re: /ocheck - by iKevin - 26.03.2016, 18:22
Re: /ocheck - by SickAttack - 26.03.2016, 19:49
Re: /ocheck - by iKevin - 27.03.2016, 10:16
Re: /ocheck - by Nero_3D - 27.03.2016, 11:07
Re: /ocheck - by iKevin - 27.03.2016, 12:19

Forum Jump:


Users browsing this thread: 1 Guest(s)