w3rt1x Posted July 25, 2022 Share Posted July 25, 2022 local x, y, z = 215.54638671875,2068.0607910156,20 local marker = createMarker(x, y, z, "cylinder", 1.3, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function(hitPlayer, matchingDimension) if hitPlayer == getLocalPlayer() then giveWeapon(hitPlayer, 23, 250) end end) attempt to call global 'giveWeapon' (a nil value) hello everyone, how to fix it? Link to comment
!#NssoR_) Posted July 25, 2022 Share Posted July 25, 2022 giveWeapon is Serve-Side function. Link to comment
Shady1 Posted December 19, 2022 Share Posted December 19, 2022 On 25/07/2022 at 20:43, w3rt1x said: local x, y, z = 215.54638671875,2068.0607910156,20 local marker = createMarker(x, y, z, "cylinder", 1.3, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function(hitPlayer, matchingDimension) if hitPlayer == getLocalPlayer() then giveWeapon(hitPlayer, 23, 250) end end) attempt to call global 'giveWeapon' (a nil value) hello everyone, how to fix it? hello, I have prepared a code related to your problem, if your problem persists, you can try this code --client local x, y, z = 215.54638671875,2068.0607910156,20 local marker = createMarker(x, y, z, "cylinder", 1.3, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function(hitPlayer, matchingDimension) if hitPlayer == getLocalPlayer() then triggerServerEvent("giveWeaponToPlayer", hitPlayer, 23, 250) -- weapon id is 23 and ammo is 250 end end) --server addEvent("giveWeaponToPlayer", true) addEventHandler("giveWeaponToPlayer", root, function(weaponID, weaponAmmo) giveWeapon(client, weaponID, weaponAmmo) end ) 1 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