Jump to content

[Help] Instantaneously stop player from running & Knockback


chris1384

Recommended Posts

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 by chris1384
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...