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