Seba500PLK Posted October 26, 2015 Posted October 26, 2015 When a player try to rammed it nothing happens. --Client function DamageToPed(attacker, weapon, bodypart, loss) cancelEvent() if weapon and attacker then if weapon == 49 then --Rammed outputChatBox("Rammed") end if bodypart == 9 then --HeadShot setElementHealth(source, 0) end end end addEventHandler("onClientPedDamage", getRootElement(), DamageToPed)
KariiiM Posted October 26, 2015 Posted October 26, 2015 source is not defined in client side function DamageToPed(attacker, weapon, bodypart, loss) if weapon and attacker and attacker ~= getLocalPlayer() then if weapon == 49 then --Rammed outputChatBox("Rammed") end if bodypart == 9 then --HeadShot setElementHealth(getLocalPlayer(), 0) end cancelEvent() end end addEventHandler("onClientPedDamage", getRootElement(), DamageToPed)
Seba500PLK Posted October 26, 2015 Author Posted October 26, 2015 source is not defined in client side function DamageToPed(attacker, weapon, bodypart, loss) if weapon and attacker and attacker ~= getLocalPlayer() then if weapon == 49 then --Rammed outputChatBox("Rammed") end if bodypart == 9 then --HeadShot setElementHealth(getLocalPlayer(), 0) end cancelEvent() end end addEventHandler("onClientPedDamage", getRootElement(), DamageToPed) ... source is victim
Seba500PLK Posted October 26, 2015 Author Posted October 26, 2015 Its client side or i'm wrong? yes client
KariiiM Posted October 26, 2015 Posted October 26, 2015 So source isn't defined in client side only in server side you've to replace it by localPlayer or getLocalPlayer() no matter
Seba500PLK Posted October 26, 2015 Author Posted October 26, 2015 So source isn't defined in client side only in server side you've to replace it by localPlayer or getLocalPlayer() no matter https://wiki.multitheftauto.com/wiki/OnClientPedDamage The source of this event is the ped that got damaged CHECK
KariiiM Posted October 26, 2015 Posted October 26, 2015 I know it, it mean the player that got damaged by the attacker, if you're in server side simply you will put source but in client side , there's localPlayer BTW, explain exactly what do you want to make and maybe i can help you
Seba500PLK Posted October 26, 2015 Author Posted October 26, 2015 my bots (zombies) if is cancelEvent() they can not be to rammed
KariiiM Posted October 26, 2015 Posted October 26, 2015 Thank you for your interest You're welcomed my friend
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