chris1384 Posted January 16, 2018 Share Posted January 16, 2018 (edited) Hi there! Recently I have this problem with knockbacking the victim and instantaneosly stop the victim from walking/running. 1. I tried using spawnPlayer with current coordinates and position, but for a second it can be seen that once spawned it turns smoothly from 0 to 90 degrees. I wonder if there's an alternative for this: function cancelrun ( attacker, weapon, bodypart, loss ) if attacker ~= nil then if isPedOnGround(source) then local x,y,z = getElementPosition(source) local r = getElementRotation(source) local skin = getElementModel(source) local h = getElementHealth(source) spawnPlayer(source, x,y,z,r) setElementModel(source, skin) setElementHealth(source, h) end end end addEventHandler ( "onPlayerDamage", getRootElement(), cancelrun ) 2. With 'knockback' I mean if the victim is getting damage I want him to be pushed back. An example might be very helpful. Thanks! Edited January 16, 2018 by chris1384 Link to comment
KaMi Posted January 16, 2018 Share Posted January 16, 2018 You can use setPedAnimation but you need the correct anim. Link to comment
Tails Posted January 17, 2018 Share Posted January 17, 2018 I've used this animation before, pretty sure it's this one setPedAnimation(elem, "ped", "floor_hit", 1000, false, true, false); 1 Link to comment
Storm-Hanma Posted January 17, 2018 Share Posted January 17, 2018 2 hours ago, Tails said: I've used this animation before, pretty sure it's this one setPedAnimation(elem, "ped", "floor_hit", 1000, false, true, false); This will work as you said tails ! Link to comment
chris1384 Posted January 17, 2018 Author Share Posted January 17, 2018 Thanks everyone for your help! 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