Jump to content

Does the server see the player's money amount?


Moony

Recommended Posts

I've successfully created a marker that triggers 'givePlayerMoney' and 'outputChatBox' when 'onClientMarkerHit' in a client.Lua.

Does the server see the amount of money the player now has? Do I have to sync the money to the server with some kind of 'getPlayerMoney' in a server.Lua?

I'm planning on making a weapons GUI that works with the player's money.

Link to comment

 

15 hours ago, #\_oskar_/# said:

if you want to buy weapons By GUI
you should use this functions


#Client

OnClientGUIClick

triggerServerEvent

#Server

getPlayerMoney

giveWeapon 

 

Would it be ok to reply here instead of making a new topic?

I got this far:

-- Already created all the GUI elements.
-- Reference:
-- "onWep": GUI window.
-- "closeGUI": name given to close button.

function markerVisible (player, onWep) -- This works normally. It also shows all the child elements (buttons, labels, close button).
	local sound = playSound ("sounds/merchantWAYB.mp3")
	guiSetVisible (weaponGUI, true)
	showCursor (true)
end
addEventHandler("onClientMarkerHit", onWep, markerVisible)

function markerInvisible (closeGUI)
	if (guiGetVisible(weaponGUI) == true) then -- Refer to legend to get source of this bit.
	guiSetVisible (weaponGUI, false)
	showCursor (false)
	end
end
addEventHandler("onClientGUIClick", closeGUI, markerInvisible, false)

Legend: I got the 'if' from here

I'm getting an error: line 43 (addEventHandler), expected element at argument 2, got nil.

What could be the problem?

Link to comment
Spoiler
27 minutes ago, Moony said:

 

Would it be ok to reply here instead of making a new topic?

I got this far:



-- Already created all the GUI elements.
-- Reference:
-- "onWep": GUI window.
-- "closeGUI": name given to close button.

function markerVisible (player, onWep) -- This works normally. It also shows all the child elements (buttons, labels, close button).
	local sound = playSound ("sounds/merchantWAYB.mp3")
	guiSetVisible (weaponGUI, true)
	showCursor (true)
end
addEventHandler("onClientMarkerHit", onWep, markerVisible)

function markerInvisible (closeGUI)
	if (guiGetVisible(weaponGUI) == true) then -- Refer to legend to get source of this bit.
	guiSetVisible (weaponGUI, false)
	showCursor (false)
	end
end
addEventHandler("onClientGUIClick", closeGUI, markerInvisible, false)

Legend: I got the 'if' from here

I'm getting an error: line 43 (addEventHandler), expected element at argument 2, got nil.

What could be the problem?

 

[SOLVED]

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...