• Gamemode money...
    14 replies, posted
Hello! I know that this is old theme but i need some examples on how to add a money system into gamemode... I need remove money, add money and set money scripts... also Save and Load scripts... Can anyone help?
I can lua code.
I am also interested in the Save / Load script :p
For Save/Load: [url]http://wiki.garrysmod.com/?title=File[/url] For Money: [url]http://wiki.garrysmod.com/?title=Entity.SetNetworkedInt[/url] [url]http://wiki.garrysmod.com/?title=Entity.GetNetworkedInt[/url] Always check the wiki ;)
[QUOTE=selby3962;16380777]For Save/Load: [url]http://wiki.garrysmod.com/?title=File[/url] For Money: [url]http://wiki.garrysmod.com/?title=Entity.SetNetworkedInt[/url] [url]http://wiki.garrysmod.com/?title=Entity.GetNetworkedInt[/url] Always check the wiki ;)[/QUOTE] Aww thanks you very much man!!! This solves most of my problems... About the wiki, i looked at the wiki but not everywhere =)
Don't use file library to save and load money, use [url]http://wiki.garrysmod.com/?title=Player.SetPData[/url] to save and [url]http://wiki.garrysmod.com/?title=Player.GetPData[/url] to load.
[QUOTE=TeamReality;16391640]Don't use file library to save and load money, use [url]http://wiki.garrysmod.com/?title=Player.SetPData[/url] to save and [url]http://wiki.garrysmod.com/?title=Player.GetPData[/url] to load.[/QUOTE] Aaand what if the server crashes?
[QUOTE=kevkev;16392140]Aaand what if the server crashes?[/QUOTE] Exactly. In order to use that properly you'd need to combine that with file.write, but why bother when you can just use file.write alone.
Use SQL :]
[QUOTE=themaw;16417532]Use SQL :][/QUOTE] More like SQLite, else you would need to buy an extra server/install MySQL.
[QUOTE=kevkev;16418682]More like SQLite, else you would need to buy an extra server/install MySQL.[/QUOTE] Or a computer that is constantly running XAMPP
Which my computer is doing ^^
[QUOTE=Darrylop;16424202]Or a computer that is constantly running XAMPP[/QUOTE] This would be complete fail XAMPP is really bad and so is WAMP either compile MySQL yourself or dont bother also you can get free MySQL hosting that would be much faster and more convinient off the web using your own PC to host a database will end in fail
No matter what you do there's always the possibility of losing data when crashing.
[QUOTE=grea$emonkey;16477305]No matter what you do there's always the possibility of losing data when crashing.[/QUOTE] Depending how you set it up. If you set up the data while playing then the data will still be stored either direct reading (from txt files) or SQLite or some other way. But ofc there is possibilities that you will loose it.
Sorry, you need to Log In to post a reply to this thread.