jkub Posted August 31, 2009 Share Posted August 31, 2009 I need a ped behind the ammunation counter so when someone shoots at him he can shoot back at the attacker just like in the normal game. I already created the ped and placed him behind the counter but the code does not work right for shooting the attacker. Please help? function pedDefend ( attacker, weapon, bodypart ) local x, y, z = getElementPosition ( attacker ) setPedWeaponSlot ( source, 3 ) setPedAimTarget ( source, x, y, z ) setPedLookAt ( source, 0, 0, 0, 999999, attacker ) setTimer ( setPedControlState, 200, 0, source, "fire", true ) end addEventHandler ( "onClientPedDamage", getRootElement(), pedDefend ) Link to comment
Gamesnert Posted August 31, 2009 Share Posted August 31, 2009 Perhaps it's a good idea to toggle control "aim_weapon" too. Link to comment
jkub Posted August 31, 2009 Author Share Posted August 31, 2009 They have that function for peds? Link to comment
Gamesnert Posted August 31, 2009 Share Posted August 31, 2009 I mean setPedControlState. setTimer ( setPedControlState, 200, 0, source, "aim_weapon", true ) 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