Maurize Posted May 23, 2012 Share Posted May 23, 2012 addEventHandler( "onClientPedDamage", getRootElement(), function( attacker, weapon ) if ( attacker ) and ( weapon < 22 ) then local helperPed = getPlayerHelper( getLocalPlayer() ) setPedControlState( helperPed, "fire", true ) end cancelEvent() end ) but if he gets hurt he only shoot one time.. the other times he doesnt? Link to comment
Jaysds1 Posted May 23, 2012 Share Posted May 23, 2012 (edited) Snap, just read again Thanks solid Edited May 24, 2012 by Guest Link to comment
Castillo Posted May 24, 2012 Share Posted May 24, 2012 @Maurize: That's because you have to use a timer to set it to false then to true. @Jaysd1: You should have read his posts more carefully, he said that the ped only shoots once. Link to comment
Maurize Posted May 24, 2012 Author Share Posted May 24, 2012 something like that? addEventHandler( "onClientPedDamage", getRootElement(), function( attacker ) if ( attacker ) then local helperPed = getPlayerHelper( attacker ) setTimer( function() local posX1, posY1, posZ1 = getElementPosition( attacker ) local posX2, posY2, posZ2 = getElementPosition( helperPed ) setPedRotation( helperPed, findRotation( posX1, posY1, posX2, posY2 ) - 180 ) setPedAimTarget( helperPed, posX1, posY1, posZ1 ) setPedControlState( helperPed, "fire", true ) setPedControlState( helperPed, "fire", false ) end, 1000, 5 ) end end ) Link to comment
Castillo Posted May 24, 2012 Share Posted May 24, 2012 No, I said a timer to set the "fire" control state to false then to true, constantly. addEventHandler ( "onClientPedDamage", getRootElement(), function ( attacker, weapon ) if ( attacker ) and ( weapon < 22 ) then local helperPed = getPlayerHelper ( localPlayer ) if ( helperPed ) then setPedControlState ( helperPed, "fire", true ) setTimer ( function ( thePed ) if ( thePed ) then setPedControlState ( thePed, "fire", false ) end end ,200, 0, helperPed ) setTimer ( function ( thePed ) if ( thePed ) then setPedControlState ( thePed, "fire", true ) end end ,500, 0, helperPed ) end cancelEvent ( ) end ) Link to comment
Maurize Posted May 24, 2012 Author Share Posted May 24, 2012 Yep exactly what i meant! Nice my punk ped is following me and if i hurt him he becames insane and beat the shit out of me:D my own "zombie" resource:D Thanks friends youre the best! Link to comment
Jaysds1 Posted May 24, 2012 Share Posted May 24, 2012 Yep exactly what i meant! Nice my punk ped is following me and if i hurt him he becames insane and beat the :~ out of me:D my own "zombie" resource:DThanks friends youre the best! :lol: Nice, and np(even though I miss read ) 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