TheNightRider Posted January 1, 2011 Share Posted January 1, 2011 Hi there, I have a problem with my code, its just simple triggering but I dont know why it doesn't works -- Server sided root = getRootElement() function gW(gid,gammo) giveWeapon(source,gid,gammo) end addEvent("giveW",true) addEventHandler("giveW",root,gW) -- client sided function giveWeapon(wID,wAmmo) triggerServerEvent("giveW",getLocalPlayer(),id,ammo) end I am trying to use it as, --client function onSpawn() gang = guiGridListGetSelectedItem(gangName) skin = guiGridListGetSelectedItem(gangSkins) if gang == grove then giveWeapon(22,100) giveWeapon(29,300) giveWeapon(30,350) giveWeapon(27,99) if skin == skin1 then spawnSkin = 105 elseif skin == skin2 then spawnSkin = 106 elseif skin == skin3 then spawnSkin = 107 elseif skin == skin4 then spawnSkin = 207 end end end ---there are more --- event I am using is addEventHandler("onClientGUIClick",button,onSpawn,false) and trying to give the weapon when player spawns Thanks Link to comment
Castillo Posted January 2, 2011 Share Posted January 2, 2011 client side: function giveWeapon(wID,wAmmo) triggerServerEvent("giveW",getLocalPlayer(),wID,ammo) end server side: root = getRootElement() function gW(gid,gammo) giveWeapon(source,tostring(gid),tostring(gammo)) end addEvent("giveW",true) addEventHandler("giveW",root,gW) Link to comment
TheNightRider Posted January 2, 2011 Author Share Posted January 2, 2011 That's awesome thanks. I think ive played along side you in Mini Missions in the past Thanks for the reply that was most helpful. 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