Scripting Posted March 21, 2012 Share Posted March 21, 2012 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
Absence2 Posted March 21, 2012 Share Posted March 21, 2012 wtf, what is this lol? https://wiki.multitheftauto.com/wiki/Scr ... troduction start over from scratch man Link to comment
CapY Posted March 21, 2012 Share Posted March 21, 2012 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
Moderators IIYAMA Posted March 21, 2012 Moderators Share Posted March 21, 2012 What is the server side? triggerServerEvent("givem",getLocalPlayer()) You can't trigger to nothing.... Link to comment
drk Posted March 21, 2012 Share Posted March 21, 2012 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
Kenix Posted March 22, 2012 Share Posted March 22, 2012 scripter_new, Can you explain what you want create? 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