Enargy, Posted February 10, 2015 Share Posted February 10, 2015 (edited) < Coin System > Hey guys, I bring a coin system to avoid both use money game and use something different can have for a roleplay or specific server. * features: this system gives also be able to use in different incidents since it has functions that can be exported from himself. - SERVER (syntax): · setPlayerCoin (player theplayer, int amount) - set a specific value. · givePlayerCoin (player theplayer, int amount) - establishes a summed with the previous value. · takePlayerCoin (player theplayer, int amount) - the specific value is taken. · getPlayerCoin (player theplayer) - gets the values that has a player. - CLIENT-SIDE (syntax): · getPlayerCoin (player theplayer) Examples: function mycs(thePlayer, command) local mycoins = exports.coinsystem:getPlayerCoin(thePlayer) if ( mycoins >= 10000 ) then outputChatBox("you have more than 10000 coins.", thePlayer, 0, 255, 0, false) else outputChatBox("you have less than 10000 coins.", thePlayer, 255, 0, 0, false) end end addCommandHandler("coins", mycs) addEventHandler("onPlayerJoin", root, function() exports.coinsystem:setPlayerCoin(source, 1000) end) function buyWeapon(thePlayer, command) local prize = 20000 local mycoins = exports.coinsystem:getPlayerCoin(thePlayer) if ( mycoins >= tonumber(prize) ) then giveWeapon(thePlayer, 31, 2000) exports.coinsystem:takePlayerCoin(thePlayer, prize) outputChatBox("you bought a M4.", thePlayer, 0, 255, 0, false) else outputChatBox("you don't have enough coins!", thePlayer, 255, 0, 0, false) end end addCommandHandler("buyw", buyWeapon) Commands (only admins) there are commands that can only be used by the admin group. syntax: /setcoin <playername> <amount> syntax: /givecoin <playername> <amount> EDIT: Changelog [b]1.3.0[/b] - META config was removed by some bugs that caused and it was decompiled to edit your preference. [b]1.2.0[/b] - Some bugs was fixed. [b]1.1.0[/b] - Resource release. Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10944 Thnx Edited March 27, 2015 by Guest Link to comment
..:D&G:.. Posted February 10, 2015 Share Posted February 10, 2015 It's cool but eh... Why did you compile it if you wanted to release it? Link to comment
Enargy, Posted February 10, 2015 Author Share Posted February 10, 2015 I don't think being compiled affect so much and its just for security case Link to comment
..:D&G:.. Posted February 10, 2015 Share Posted February 10, 2015 People can compile them themselves after they edited them as they wanted. For example I cannot use the script because I cannot configure it with my gamemode Link to comment
Et-win Posted February 11, 2015 Share Posted February 11, 2015 Noobs editing it and claiming it as theirs, maybe that's why. Link to comment
Enargy, Posted February 11, 2015 Author Share Posted February 11, 2015 [quote name=..&G:..]People can compile them themselves after they edited them as they wanted. For example I cannot use the script because I cannot configure it with my gamemode The script was made to work for any gamemode and also for a custom hud Link to comment
..:D&G:.. Posted February 11, 2015 Share Posted February 11, 2015 [quote name=..&G:..]People can compile them themselves after they edited them as they wanted. For example I cannot use the script because I cannot configure it with my gamemode The script was made to work for any gamemode and also for a custom hud I want to make it save in mysql for example, but I cannot do that as it's compiled Link to comment
Johnny Killstone Posted February 11, 2015 Share Posted February 11, 2015 Maybe you could add an non compiled part then with function prototypes having the same arguments that is called from the original functions, that would allow writing extensions and protect your code. Just a tip, otherwise it looks interesting, a smart foundation to start with in case you need to make extended money features. Link to comment
Enargy, Posted February 13, 2015 Author Share Posted February 13, 2015 Updated! 1.2.0 - A new exception was added in the meta file to restrict the use of commands by Admin group. https://community.multitheftauto.com/index.php?p= ... 944d=10944 Link to comment
Enargy, Posted March 27, 2015 Author Share Posted March 27, 2015 Updated! 1.3.0 https://community.multitheftauto.com/in ... s&id=10944 Link to comment
..:D&G:.. Posted March 27, 2015 Share Posted March 27, 2015 Kinda late for this uncompiled version, I did my own coins system already, but this is still one of the only coins system on community, good job Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now