SA-MP Forums Archive
Big Problem!! - 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: Big Problem!! (/showthread.php?tid=363043)



Big Problem!! - Akcent_Voltaj - 26.07.2012

why do money each time i come in my server the set to -50...how could i do it so if i leave with 500$ then when i go back i get 500$ back ...why?whats cauzing?dont know..


Re: Big Problem!! - Akcent_Voltaj - 26.07.2012

Please help anybody i have a server of 30 people and locked please help say answer..


Re: Big Problem!! - Cjgogo - 26.07.2012

OMG,I am actually a bit astonished you could not realize you need a DataBase system.


Re: Big Problem!! - Akcent_Voltaj - 26.07.2012

Saving sistem?
OFF:Sunt roman si eo
ENG:im romanian too


Re: Big Problem!! - Cjgogo - 26.07.2012

Yes you need a saving system,and that can be easily done using Y_INI wich is my favorite DataBase system,you can find links here :https://sampforum.blast.hk/showthread.php?tid=175565.At a first look it may look complicated BUT IT'S NOT if you read it integrally.


Re: Big Problem!! - Dan. - 26.07.2012

Yes you need a saving system to save your money. I recommend MySQL.

E:// Too late.


Re: Big Problem!! - Akcent_Voltaj - 26.07.2012

Here i have saving sistem..
PHP код:
    format(var, 32"Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                        
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); 



Re: Big Problem!! - Cjgogo - 26.07.2012

YES,you do but you need to load the data,and you can't do that without a DataBase from files in wich you STORE the player's info...


Re: Big Problem!! - Marv! - 26.07.2012

Steps for creation:

1.) Make a new variable using the "new" function.
2.) Put GetPlayerCash function under OnPlayerDisconnect callback.
3.) And, GivePlayerCash function under OnPlayerSpawn callback.

Example :

new pMoney;

OnPlayerSpawn - GivePlayerCash(playerid, {variable} );

OnPlayerDisconnect - - GetPlayerCash(playerid);


---------------------------------------------

Get a database system to store the variable of the cash onto player accounts.



Re: Big Problem!! - Akcent_Voltaj - 26.07.2012

i just put mysql and thats all??