Loaaaaaaaad [REP++]
#1

I made a police system it works and when the player disconnected and connected again it load his police level.
The problem that if the server losed and re-open it set the player levle to 0.
Here is some codes might help
PHP код:
stock LoadLevel(name[],value[],playerid)
{
new 
file[60];
format(file,sizeof(file),"/police/%s.ini",playerid);
INI_Open(file);
return 
1;
}
public 
OnPlayerConnect(playerid)
{
LoadLevel("Police",Playerinfo[playerid][pPolice],playerid);
return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Police",PlayerInfo[playerid][pPolice]);
    
INI_Close(File);
    return 
1;

Here is the save and under the command that make a police officer
PHP код:
PlayerInfo[playerid][pPoilce] = level
Please Help !!
I am using Y_ini btw
Reply
#2

server variables are reseted when it's closed, and I don't get what "LoadLevel" do ?
Reply
#3

First: if the variable restart variables how does my login system work ?
Second: LoadLevel to open the file then read from it OnPlayerDisconnect.
Reply
#4

I have a question, can you check that ini file to see if it contains informations or not, I mean server lose data when closed that the cop level stay on the variable, but when closed it's not loaded again.
Reply
#5

The information is still in the file when i close the server
Reply
#6

Save the player's stats in OnGameModeExit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)