Moony Posted February 22, 2020 Share Posted February 22, 2020 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
#\_oskar_/# Posted February 23, 2020 Share Posted February 23, 2020 if you want to buy weapons By GUI you should use this functions #Client OnClientGUIClick triggerServerEvent #Server getPlayerMoney giveWeapon 2 Link to comment
Castillo Posted February 23, 2020 Share Posted February 23, 2020 Money given or taken client-side is not synced with the server, you have to give the money in the server side. 1 1 Link to comment
Moony Posted February 23, 2020 Author Share Posted February 23, 2020 41 minutes ago, Castillo said: Money given or taken client-side is not synced with the server, you have to give the money in the server side. ¡Perfecto! Muchas gracias, compa argento. 1 Link to comment
Moony Posted February 23, 2020 Author Share Posted February 23, 2020 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
Moony Posted February 23, 2020 Author Share Posted February 23, 2020 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
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