Maurize Posted May 23, 2012 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?
Jaysds1 Posted May 23, 2012 Posted May 23, 2012 (edited) Snap, just read again Thanks solid Edited May 24, 2012 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted May 24, 2012 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Maurize Posted May 24, 2012 Author 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 )
Castillo Posted May 24, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Maurize Posted May 24, 2012 Author 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!
Castillo Posted May 24, 2012 Posted May 24, 2012 You're welcome . San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jaysds1 Posted May 24, 2012 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 ) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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