• [DarkRP] Remove moneys from client.
    4 replies, posted
I've made a panel that will remove 5$ from a player. But turns out you can't use: DarkRP:AddMoney(-100) -- Can only use for Server Net.Send -- Then I thought about sending it over to the server and then remove them. Turns out! Net.Send is server!! GOD! Now I just need some help. I wanna remove 5$ from a player on the client side.
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/net/SendToServer"]net.SendToServer[/URL] alternatively, you could create a console command
Just make sure you check specially serverside in the netmessage receiver, else they could exploit it and add money.
Here's a small example of what your code should look like [code] -- server util.AddNetworkString 'takemoney' net.Receive( 'takemoney', function( _, ply ) -- called when the client sends the message. The second arg (ply) is the player that sent it -- Run some checks to prevent exploiting ply:addMoney( -5 ) end ) -- client function button:DoClick() net.Start( 'takemoney' ) -- we're gonna be using the network string we created in the server side net.SendToServer() -- Now let the server know the button was click end [/code]
-snip-
Sorry, you need to Log In to post a reply to this thread.