Jump to content

killPed help!


Recommended Posts

Okay Now I've been trying to find the solution but can't.

Here it is. I need something like onPlayerDamage but ped. IsPedDead is not good i tried it. I'm trying to make a resource, when you kill a ped you have an output message. Can somebody help me please?

Nick

Link to comment

So i've tried this but this did not work. I guess i did some fatal error

function PedWasted() 
setElementHealth ( killer, 0  )  
outputChatBox( "Just in the middle", player, 255, 0, 0 ) 
end 
addEventHandler("onClientPedWasted", getRootElement(), PedWasted) 
  
  

Edit: It didn't work even. It's for only players. I thought peds are non player npcs in MTA. I've tried this with the citizens resource.

function PedDamage() 
outputChatBox("Just in the middle", player, 255, 0, 0) 
end 
addEventHandler("onClientPedDamage", getRootElement(), PedDamage) 

Edited by Guest
Link to comment

Thanks. One more thing. In this:

function PedWasted(player) --The player definition goes here i think 
setElementHealth ( killer, 0  )  
outputChatBox( "Just in the middle", player, 255, 0, 0 ) 
end 
addEventHandler("onClientPedWasted", getRootElement(), PedWasted) 
  
  

But how to define killer in this one?

Thank you for helping a beginner

EDIT:These are for only player or NPC's too? Cuz' not working. I'm doing something wrong

  
function PedDamage(player) 
outputChatBox("Just in the middle", player, 255, 0, 0) 
end 
addEventHandler("onClientPedDamage", getRootElement(), PedDamage) 

Link to comment
function PedWasted(player) --The player definition goes here i think 
setElementHealth ( source, 0  ) 
outputChatBox( "Just in the middle", player, 255, 0, 0 ) 
end 
addEventHandler("onClientPedWasted", getRootElement(), PedWasted) 

Link to comment

I mean: It works when i kill a player, i die. But when i kill a ped, an npc(don't know what the difference is) it not works. I'm trying this on the citizens resource:https://community.multitheftauto.com/index.php?p=resources&s=details&id=3390

Link to comment

Just one more thing:

  
addEventHandler ( "onPedWasted", root, 
    function ( _, killer ) 
        setElementHealth ( killer, -50 ) -- It not works 
        outputChatBox ( "Just in the middle", killer, 255, 0, 0 ) 
    end 
) 
  

In clientside it should be working i think. How can i just decrease hp?

Link to comment

You have to get the player health then decrease it.

addEventHandler ( "onPedWasted", root, 
    function ( _, killer ) 
        setElementHealth ( killer, ( getElementHealth ( killer ) - 50 ) ) 
        outputChatBox ( "Just in the middle", killer, 255, 0, 0 ) 
    end 
) 

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