Jump to content

stop vehicles killing players


Twisted

Recommended Posts

Posted

this may be a nooby question but me and my friend (good scripter) cant seem to cancel the event when some one is injured by a vehicle maybe some of u could help :)

function nodamage(attacker, bodypart) 
vehicle = getPedOccupiedVehicle(source) 
if (vehicle) then 
cancelEvent() 
end 
end 
addEventHandler("onClientPlayerDamage", getRootElement(),nodamage) 
  

Posted

gokal, that's the same but without the "()"...... :roll:

He's trying to do when someone get's injured by a vehicle it will not take health from him.

function nodamage(attacker, bodypart) 
local vehicle = getPedOccupiedVehicle(attacker) 
if (vehicle) then 
cancelEvent() 
  end 
end 
addEventHandler("onClientPlayerDamage", getLocalPlayer(),nodamage) 

Try with that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
attacker: A player element representing the attacker or vehicle element (when being run over or falling off a bike).

That's from the onClientPlayerDamage page so can't it just be:

function nodamage(attacker, bodypart) 
if getElementType(attacker) == 'vehicle' then 
cancelEvent() 
end 
addEventHandler("onClientPlayerDamage", getLocalPlayer(),nodamage) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

Yeah, I forgot about that :P.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...