Twisted Posted July 1, 2011 Share Posted July 1, 2011 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) Link to comment
gokalpfirat Posted July 1, 2011 Share Posted July 1, 2011 Use not if (vehicle) then Use: if vehicle then Link to comment
Castillo Posted July 1, 2011 Share Posted July 1, 2011 gokal, that's the same but without the "()"...... 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. Link to comment
JR10 Posted July 1, 2011 Share Posted July 1, 2011 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) Link to comment
Twisted Posted July 1, 2011 Author Share Posted July 1, 2011 thank you castillo and JR10 for helping me i am a noob at canceling events 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