Hi Guys i make a food system and i have a problem with "addMoney" Command.
I Make a simple button, I call the ply action.
[CODE]local ply = LocalPlayer()[/CODE]
Then in my Button.DoClick
[CODE]
if ply:canAfford(DCFood_BeerMasterPrice) then
ply:addMoney( -DCFood_BeerMasterPrice )
end
[/CODE]
DCFood_BeerMasterPrice = 50
Console say:
[CODE]attempt to call method 'addMoney' (a nil value)
[/CODE]
I need Help Thanks :(
addMoney is not defined on the clientside
Oh I Understand, just work with serverside.
Thank You!!
[QUOTE=Banana Lord.;52136710]addMoney is not defined on the clientside[/QUOTE]
I Try in serverside but nothing say me the same :(
[code]local ply = LocalPlayer()[/code]
This will not work serverside as well. If you want to do this from the client, you'll need to send a net message with the request and do all the checks there
[QUOTE=davicyyo;52137417]I Try in serverside but nothing say me the same :([/QUOTE]
What's the serverside code
[QUOTE=solid_jake;52137444][code]local ply = LocalPlayer()[/code]
This will not work serverside as well. If you want to do this from the client, you'll need to send a net message with the request and do all the checks there[/QUOTE]
Okey i try a code serverside
[editline]22nd April 2017[/editline]
[QUOTE=TheVac;52137446]What's the serverside code[/QUOTE]
i make a serverside in few minutes
I Make a Net and it's work.
Thank you Dan for help Me.
[URL="https://wiki.garrysmod.com/page/Net_Library_Usage"]https://wiki.garrysmod.com/page/Net_Library_Usage[/URL]
Sorry, you need to Log In to post a reply to this thread.