Jump to content

Kills Shooter


'LinKin

Recommended Posts

  • Moderators
Hello,

I'm using

createProjectile 

The creator element is a player's vehicle.

So, when I shoot someone and kill him, how can I display something like "LinKin has killed RandomGuy" in the chatbox?

Thanks.

Can you output the type of the killer from the event onPlayerWasted ?

Want to see if it's somehing like "player" or "vehicle" or "boolean"

Link to comment
  • Moderators
Harder to know if the driver has been killed by that shot ...

Why so?

if weapon == 19 then  

I haven't tested it either but I hope it works. :mrgreen:

I'm sorry but you can survive if the projectile just damage my vehicle but not enough to explode. Even if my car is on fire after that.

Link to comment

Harder to know if the driver has been killed by that shot ...

Harder than what? onPlayerWasted doesn't set the killer as the creator of the projectile that you were killed by, so onClientVehicleDamage is the best way to do it. Just save the player that hit you last, and check if you died in an explosion within 5 seconds since then.

Link to comment
  • Moderators
onPlayerWasted doesn't set the killer as the creator of the projectile that you were killed by

I didn't know that, that's why I asked him to use an output to see if the killer element was nil or if not, the type of this element.

So yeah, now I know the killer is nil, then your solution is surely the best workaround I can imagine so far.

Link to comment

I'm going to try.

But hm, yes one can survive a explosion. When you are on fire, and you hit an explosive barrel, your vehicle is not blown.

Now in this case, for projectiles, if the projectile doesn't hit the player directly but it explodes near to it, then the player would lose some HP but not die.

Hm. I think that I got what you're trying to say:

onClientVehicleDamage - Save the player who caused that damage.

addEventHandler("onClientVehicleDamage", root,

function(attacker, weapon)

if attacker and weapon then

if weapon == 19 then

setElementData(localPlayer, "probKiller", attacker)

end

end

end)

And then onPlayerWasted, take that stored value.

Am I right?

Link to comment
I'm going to try.

But hm, yes one can survive a explosion. When you are on fire, and you hit an explosive barrel, your vehicle is not blown.

Now in this case, for projectiles, if the projectile doesn't hit the player directly but it explodes near to it, then the player would lose some HP but not die.

Hm. I think that I got what you're trying to say:

onClientVehicleDamage - Save the player who caused that damage.

addEventHandler("onClientVehicleDamage", root,

function(attacker, weapon)

if attacker and weapon then

if weapon == 19 then

setElementData(localPlayer, "probKiller", attacker)

end

end

end)

And then onPlayerWasted, take that stored value.

Am I right?

Yep and that's how I detect DD kills.

Link to comment
  • Moderators
And then onPlayerWasted, take that stored value.

Am I right?

Yeah but don't forget to use a setTimer to remove that element data after like 5 or 8 seconds like arezu said.

Because if the guy dies for another reason 20 mins after he got damaged by the rocket, then your script will think that the creator of this rocket killed that guy.

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