Help me with saving system please
#6

Ok make this variable global.
PHP код:
new Logged[MAX_PLAYERS]; 
After that add this at OnPlayerConnect()
PHP код:
public OnPlayerConnect(playerid)
{
     
//Rest of your code
      
Logged[playerid] = 0;
      return 
1;

After that add this at OnPlayerSpawn()
PHP код:
Logged[playerid] = 1
Then,
PHP код:
function SaveAccountStats(playerid)
{
if(
Logged[playerid] == 1){
    new
        
INI:File INI_Open(UserPath(playerid))
    ;
    
INI_SetTag(File,"data");
    
    
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
    new
        
Float:x,
        
Float:y,
        
Float:z
    
;
    
GetPlayerPos(playerid,x,y,z);
    
PlayerInfo[playerid][pPos_x] = x;
    
PlayerInfo[playerid][pPos_y] = y;
    
PlayerInfo[playerid][pPos_z] = z;
    
GetPlayerPos(playerid,PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
    
    
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
    
INI_WriteInt(File"Experience",PlayerInfo[playerid][pExp]);
    
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
    
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
    
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
    
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
    
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJobID]);
    
INI_WriteInt(File,"Gun1",PlayerInfo[playerid][pGun1]);
    
INI_WriteInt(File,"Gun2",PlayerInfo[playerid][pGun2]);
    
INI_WriteInt(File,"Gun3",PlayerInfo[playerid][pGun3]);
    
INI_WriteInt(File,"Gun4",PlayerInfo[playerid][pGun4]);
    
INI_WriteInt(File,"Gun5",PlayerInfo[playerid][pGun5]);
    
INI_WriteInt(File,"Gun6",PlayerInfo[playerid][pGun6]);
    
INI_WriteInt(File,"Gun7",PlayerInfo[playerid][pGun7]);
    
INI_WriteInt(File,"Gun8",PlayerInfo[playerid][pGun8]);
    
INI_WriteInt(File,"Gun9",PlayerInfo[playerid][pGun9]);
    
INI_WriteInt(File,"Gun10",PlayerInfo[playerid][pGun10]);
    
INI_WriteInt(File,"Gun11",PlayerInfo[playerid][pGun11]);
    
INI_WriteInt(File,"Gun12",PlayerInfo[playerid][pGun12]);
    
INI_WriteInt(File,"GPS",PlayerInfo[playerid][pGPS]);
    
INI_WriteInt(File,"Deposit",PlayerInfo[playerid][pDeposit]);
    
INI_WriteInt(File,"Materials",PlayerInfo[playerid][pMaterials]);
    
INI_WriteInt(File,"Packages",PlayerInfo[playerid][pPackages]);
    
INI_WriteInt(File,"Cocaine",PlayerInfo[playerid][pCocaine]);
    
INI_Close(File);
    return 
1;
    }

Reply


Messages In This Thread
Help me with saving system please - by ryansheilds - 15.01.2012, 13:37
Re: Help me with saving system please - by mineralo - 15.01.2012, 14:53
Re: Help me with saving system please - by ryansheilds - 15.01.2012, 16:08
Re: Help me with saving system please - by Bogdan1992 - 15.01.2012, 16:20
Re: Help me with saving system please - by ryansheilds - 15.01.2012, 17:01
Re: Help me with saving system please - by Bogdan1992 - 15.01.2012, 17:12
Re: Help me with saving system please - by ryansheilds - 15.01.2012, 17:40
Re: Help me with saving system please - by Bogdan1992 - 15.01.2012, 17:43
Re: Help me with saving system please - by ryansheilds - 15.01.2012, 17:52
Re: Help me with saving system please - by Bogdan1992 - 15.01.2012, 18:06

Forum Jump:


Users browsing this thread: 1 Guest(s)