Jump to content

Kills Shooter


'LinKin

Recommended Posts

Posted

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.

Posted

Colshapes :P

But as far as I know it doesn't detect projectiles.

I once made a standalone kill detection resource, works pretty good.

I can give it to you if u want :P

  • Moderators
Posted
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"

  • Moderators
Posted
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.

Posted

As far as I know you die in an explosion when getting hit by a projectile, no way to find out if it was a normal low health explosion or caused by getting shot.

Posted

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.

  • Moderators
Posted
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.

Posted

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?

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

  • Moderators
Posted
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.

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