07.11.2015, 00:12
SOLVED:
on top of game Mode i create the variables i want to store (global vars):
Here we look if exists or not, if not then create the file:
OnGameModeInit: (on server start, it will run)
I create forwards on top of GM:
now the Publics:
And Finally, to save the file from the vars:
on top of game Mode i create the variables i want to store (global vars):
Код:
new DPLS_cash; new DPLS_materiais;
OnGameModeInit: (on server start, it will run)
Код:
if(fexist("DMRPG/Buildings/DPLS.ini")) { if(togPainel == 1) { print("Arq. DPLS - Existe"); } // You can Delete this line INI_ParseFile("DMRPG/Buildings/DPLS.ini", "DPLS"); } else // se nгo existe irб criar o arquivo { if(togPainel == 1) { print("Arq. DPLS - Nao Existe"); } // You can Delete this line new INI:ini = INI_Open("DMRPG/Buildings/DPLS.ini"); INI_SetTag(ini, "DPLS VARs"); INI_WriteInt(ini, "Dinheiro", 1001); INI_WriteInt(ini, "Materiais", 1002); INI_Close(ini); INI_ParseFile("DMRPG/Buildings/DPLS.ini", "DPLS"); }
Код:
forward DPLS(name[], value[]); forward Save_DPLS();
Код:
public DPLS(name[], value[]) //here we are Reading { if(togPainel == 1) { print("Public DPLS - Leitura"); } // You can Delete this line INI_Int("Dinheiro",DPLS_cash); INI_Int("Materiais",DPLS_materiais); return 0; } public Save_DPLS() //Here we are Saving { if(togPainel == 1) { print("Public Save_DPLS"); } // You can Delete this line new INI:File = INI_Open("DMRPG/Buildings/DPLS.ini"); INI_SetTag(File,"DPLS VARs"); INI_WriteInt(File,"Dinheiro",DPLS_cash); INI_WriteInt(File,"Materiais",DPLS_materiais); INI_Close(File); return 1; }
Код:
public OnGameModeExit() { Save_DPLS(); return 1; }