bartje01 Posted November 7, 2010 Share Posted November 7, 2010 Hey guys. I have a little problem at my gui. if (source == buyweapondeagle) then giveWeapon (getLocalPlayer(),24) outputChatBox ("You've bought a deagle!") end end addEventHandler ("onClientGUIClick",getRootElement(),guiClick) It only shows me the text but it's not giving me the deagle. HOw to fix? Yes this is client side. Link to comment
ChaseOquinn Posted November 7, 2010 Share Posted November 7, 2010 giveWeapon is not client side your going to have to make a server side script. Please take a look at addEvent and triggerServerEvent on the wiki. Link to comment
Static-X Posted November 8, 2010 Share Posted November 8, 2010 Use this CLIENT: if (source == buyweapondeagle) then triggerServerEvent("giveWeaponToPlayer",getLocalPlayer()) outputChatBox ("You've bought a deagle!") end end addEventHandler ("onClientGUIClick",getRootElement(),guiClick) SERVER: addEvent("giveWeaponToPlayer",true) addEventHandler("giveWeaponToPlayer",getRootElement(),function() giveWeapon(source,24) end I hope that works 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