Jump to content

don t work!!


Scripting

Recommended Posts

removeEventHandler don t work!

client-side:

addEventHandler ( "onClientPlayerWeaponFire",localPlayer, geta) 
function geta (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) 
if ( weapon == 31) then 
triggerServerEvent("givem",getLocalPlayer()) 
end 
end 
  
 setTimer(function () 
removeEventHandler("onClientPlayerWeaponFire", localPlayer, geta) 
end,5000,1) 

Link to comment
removeEventHandler don t work!

client-side:

addEventHandler ( "onClientPlayerWeaponFire",localPlayer, geta) 
function geta (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) 
if ( weapon == 31) then 
triggerServerEvent("givem",getLocalPlayer()) 
end 
end 
  
 setTimer(function () 
removeEventHandler("onClientPlayerWeaponFire", localPlayer, geta) 
end,5000,1) 

What do you exactly want to do ?

Link to comment

This is a mess. You need learn Lua dude.

Client-side:

function geta ( weapon, ammo, ammoClip, x, y, z, element ) 
    if ( weapon == 31 ) then 
        triggerServerEvent ( "givem", element ) 
    end 
end 
addEventHandler ( "onClientPlayerWeaponFire", localPlayer, geta ) 
  
setTimer ( 
    function ( ) 
        removeEventHandler ( "onClientPlayerWeaponFire", localPlayer, geta ) 
    end, 
5000, 1 ) 

I don't know why you need remove handler after 5 seconds... But ok.

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