Level not save
#4

After the player login is successful, place this:

PHP Code:
     
       
new name[MAX_PLAYER_NAME], yourfile[256];
       
GetPlayerName(playeridnameMAX_PLAYER_NAME);
       
format(yourfile256"insert here the file you want to save the level"name);
       
PlayerInfo[playerid][pLevel] = DOF2_GetInt(yourfile,"Level");
       
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]); 
Inside the public OnPlayerDisconnect:

PHP Code:
        new name[MAX_PLAYER_NAME], yourfile[256];
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        
format(yourfile256"insert here the file you want to save the level"name);
    
        if(!
DOF2_FileExists(yourfile))
    {
           
DOF2_CreateFile(yourfile);
    }
       
        
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
        
DOF2_SetInt(yourfile"Level"PlayerInfo[playerid][pLevel]);
        
DOF2_SaveFile(); 
Then, your command should look like this:

PHP Code:
CMD:bonus(playerid

    
    
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid); 
    if(
PlayerInfo[playerid][pLevel] == 1
    { 
        
SendClientMessage(playerid,-1,"Deoarece ai folosit comanda /bonus ai primit:"); 
        
SendClientMessage(playerid,-1,"-LEVEL: 3"); 
        
SendClientMessage(playerid,-1,"-MONEY: $5.000.000"); 
        
GivePlayerMoney(playerid,5000000); 
        
SetPlayerScore(playerid3); 
        
PlayerInfo[playerid][pLevel] = 3;
    } 
    else 
    { 
        
SendClientMessage(playerid,-1,"Trebuie sa ai minim level 1 pentru a folosi aceasta comanda."); 
    } 
     return 
1

I have not tested it, but hope it works for you, if you get errors, just show me the line.
Reply


Messages In This Thread
Level not save - by Calinut200 - 24.06.2019, 19:03
Re: Level not save - by Symon - 24.06.2019, 19:51
Re: Level not save - by SiaReyes - 24.06.2019, 19:53
Re: Level not save - by SnakePit - 24.06.2019, 20:06
Re: Level not save - by Symon - 24.06.2019, 20:10
Re: Level not save - by SnakePit - 24.06.2019, 20:16

Forum Jump:


Users browsing this thread: 1 Guest(s)