Jump to content

Small error! Help urgent!


FlyingSpoon

Recommended Posts

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

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

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...