Loaaaaaaaad [REP++] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Loaaaaaaaad [REP++] (
/showthread.php?tid=558563)
Loaaaaaaaad [REP++] -
nezo2001 - 17.01.2015
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(playerid, reason)
{
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
Re : Loaaaaaaaad [REP++] -
FilesMAker - 17.01.2015
server variables are reseted when it's closed, and I don't get what "LoadLevel" do ?
Re: Loaaaaaaaad [REP++] -
nezo2001 - 17.01.2015
First: if the variable restart variables how does my login system work ?
Second: LoadLevel to open the file then read from it OnPlayerDisconnect.
Re : Loaaaaaaaad [REP++] -
FilesMAker - 17.01.2015
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.
Re: Loaaaaaaaad [REP++] -
nezo2001 - 18.01.2015
The information is still in the file when i close the server
Re: Loaaaaaaaad [REP++] -
iFiras - 18.01.2015
Save the player's stats in OnGameModeExit.