swag_k_dog Posted October 10, 2016 Share Posted October 10, 2016 (edited) I wanted to script a ped, and negate the damage he takes, but I got it wrong.. server: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() local batped = createPed(30, 2767.5, -1617, 11) setElementRotation(batped, 0, 0, -45) setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle") setTimer(giveWeapon,500,1,batped, 5, 1, true) triggerClientEvent("onClientPedDamage", resourceRoot) end ) and client: addEvent("onClientPedDamage", true) addEventHandler("onClientPedDamage", getRootElement(), function() cancelEvent() end ) whats the problem? Edited October 10, 2016 by swag_k_dog Link to comment
Walid Posted October 10, 2016 Share Posted October 10, 2016 use this client side addEventHandler("onClientResourceStart", resourceRoot, function() batped = createPed(30, 2767.5, -1617, 11) setElementRotation(batped, 0, 0, -45) setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle") setTimer(givePedWeapon,500,1,batped, 5, 1, true) addEventHandler ( "onClientPedDamage", batped, cancelPedDamage) end ) function cancelPedDamage () if source == batped then cancelEvent() end end 1 Link to comment
swag_k_dog Posted October 10, 2016 Author Share Posted October 10, 2016 On 10/10/2016 at 19:12, Walid said: use this client side addEventHandler("onClientResourceStart", resourceRoot, function() batped = createPed(30, 2767.5, -1617, 11) setElementRotation(batped, 0, 0, -45) setTimer(setPedAnimation,500,1,batped, "dildo", "dildo_idle") setTimer(givePedWeapon,500,1,batped, 5, 1, true) addEventHandler ( "onClientPedDamage", batped, cancelPedDamage) end ) function cancelPedDamage () if source == batped then cancelEvent() end end Expand Thanks for all the help. you're always here when I need you damn, scripting is getting more interesting now Link to comment
Walid Posted October 10, 2016 Share Posted October 10, 2016 On 10/10/2016 at 19:15, swag_k_dog said: Thanks for all the help. you're always here when I need you damn, scripting is getting more interesting now Expand np Link to comment
Gravestone Posted October 11, 2016 Share Posted October 11, 2016 Btw, onClientPedDamage is a MTA's event so you don't have to add it. 1 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