Turbe$Z Posted December 3, 2016 Share Posted December 3, 2016 (edited) -- client -- local w, h = guiGetScreenSize () local destroyTime local asd = 0.138 local target local localPlayer = getLocalPlayer () local allowed = true addEvent ( "allowIt", true ) addEventHandler ( "allowIt", root, function ( element ) allowed = true end ) addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon, _, _, _, _, _, element ) if not element or not allowed then return end if weapon == 23 then target = element if not destroyTime then addEventHandler ( "onClientRender", root, drawProgress ) end destroyTime = getTickCount () end end ) function drawProgress () if not getPedTarget ( localPlayer ) then destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local prog = getTickCount () - ( destroyTime or getTickCount () ) if prog > 1000 then triggerServerEvent ( "destroyIt", localPlayer, target ) destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local w2, h2 = math.floor ( w/2 ), math.floor ( h/2 ) dxDrawLine ( w2 - 72, h2 - 6, w2 - 72, h2 + 6 ) dxDrawLine ( w2 + 72, h2 - 6, w2 + 72, h2 + 6 ) dxDrawRectangle ( w2 - 69, h2 - 6, prog * asd, 12 ) end -- server -- function destroyIt (target) destroyElement(source, target) end addEvent( "destroyIt", true ) addEventHandler( "destroyIt", root, destroyIt ) no warnings / errors... Edited December 3, 2016 by Turbo777 Link to comment
MR.S3D Posted December 3, 2016 Share Posted December 3, 2016 you need kill the player? Link to comment
Turbe$Z Posted December 3, 2016 Author Share Posted December 3, 2016 No, destroy the target (vehicle, or mapped object) -sorry for my bad english Link to comment
MR.S3D Posted December 3, 2016 Share Posted December 3, 2016 try with this server function destroyIt (target) if getElementType(target) == "player" then return end destroyElement(target) end addEvent( "destroyIt", true ) addEventHandler( "destroyIt", root, destroyIt ) Link to comment
Turbe$Z Posted December 3, 2016 Author Share Posted December 3, 2016 3 minutes ago, MR.S3D said: try with this server function destroyIt (target) if getElementType(target) == "player" then return end destroyElement(target)endaddEvent( "destroyIt", true )addEventHandler( "destroyIt", root, destroyIt ) Thanks maan :DDDDDD 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