myonlake Posted November 1, 2011 Share Posted November 1, 2011 (edited) Hello, I guess I am too tired (once again) to understand this one. I am trying to see if the player is the killer of someone. function onKill(ammo, killer, weapon, bodypart) if killer == thePlayer then outputChatBox("You killed a player", thePlayer, 255, 255, 255, false) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) Let me guess, it's just one of those tiny things that I've made wrong/forgotten.. This is just for one bigger script that I'm doing. Edited May 30, 2019 by myonlake Link to comment
Castillo Posted November 1, 2011 Share Posted November 1, 2011 function onKill(ammo, killer, weapon, bodypart) if (source and getElementType(source) == "player") then outputChatBox("You killed a player", thePlayer, 255, 255, 255, false) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) What I get from what you said is that you want to check if the player/ped you've just killed is a player. Link to comment
myonlake Posted November 1, 2011 Author Share Posted November 1, 2011 (edited) Uh, forget it, I just understood one thing.. Edited November 1, 2011 by Guest Link to comment
Castillo Posted November 1, 2011 Share Posted November 1, 2011 "thePlayer" does not exists in your script... function onKill(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then outputChatBox("You killed a player", killer, 255, 255, 255, false) givePlayerMoney(killer, 100) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) This should give $100 to the killer. 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