FlyingSpoon Posted November 23, 2014 Share Posted November 23, 2014 Hi there, I only posted the code which is related to the error, I get this error when I attempt to press the 'wPistol' button, [2014-11-23 19:14:34] WARNING: weapon-system\server.lua:2: Bad argument @ 'giveWeapon' [Expected element at argument 1, got nil] Client Sided function bWep() if source == wPistol then outputChatBox("You purchased a Pistol for $250.", 255, 255, 0) takePlayerMoney(250) triggerServerEvent("bPistol", resourceRoot) end end addEventHandler("onClientGUIClick", getRootElement(), bWep) Server Sided function bPistol ( thePlayer ) giveWeapon ( thePlayer, 22, 1 ) end addEvent("bPistol", true) addEventHandler("bPistol", resourceRoot, bPistol) Link to comment
Sasu Posted November 23, 2014 Share Posted November 23, 2014 Client Sided function bWep() if source == wPistol then outputChatBox("You purchased a Pistol for $250.", 255, 255, 0) takePlayerMoney(250) triggerServerEvent("bPistol", localPlayer) end end addEventHandler("onClientGUIClick", getRootElement(), bWep) Server Sided function bPistol ( ) giveWeapon ( source, 22, 1 ) end addEvent("bPistol", true) addEventHandler("bPistol", root, bPistol) And always remember: Note: Using this function(takePlayerMoney) client side (not recommended) will not change a players money server side. Link to comment
FlyingSpoon Posted November 23, 2014 Author Share Posted November 23, 2014 Thank you, very much. Do you own SX - CnR ? If so, I visited it and it's great and full of suprises! Link to comment
Sasu Posted November 23, 2014 Share Posted November 23, 2014 I'm only a normal player but thanks anyway. 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