SA-MP Forums Archive
[Help] Save variables - 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: [Help] Save variables (/showthread.php?tid=661086)



[Help] Save variables - ApolloScripter - 21.11.2018

is it possible that I create some variable that is saved even after I close and start the server again, for example, I define the following:

PHP код:
new test;
if (! (
IsPlayerOnAdminDuty (playerid)))
return 
test 
Even after I close and start the server, I would like the test variable to remain 1, without having to check with "if" again, is that possible in any way? if anyone could teach me how to do?


Re: [Help] Save variables - ReD_HunTeR - 21.11.2018

yes.
make global variable.
When server starts(OnGameModeInit) reassign the correct value to variable.
When servers close(OnGameModeExit) save it inside the file.


Re: [Help] Save variables - ApolloScripter - 21.11.2018

But in this case, the intention is that I do not need to reassign the values ​​of the variables again, if they are already saved, understand?