'LinKin Posted March 9, 2014 Posted March 9, 2014 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.
Bonsai Posted March 9, 2014 Posted March 9, 2014 Colshapes 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
Moderators Citizen Posted March 9, 2014 Moderators Posted March 9, 2014 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"
arezu Posted March 9, 2014 Posted March 9, 2014 Use this: https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards)
Saml1er Posted March 9, 2014 Posted March 9, 2014 Use this:https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards) Cool. I don't need to use colshapes anymore.
Moderators Citizen Posted March 9, 2014 Moderators Posted March 9, 2014 Use this:https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards) Harder to know if the driver has been killed by that shot ...
Saml1er Posted March 9, 2014 Posted March 9, 2014 Use this:https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards) 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.
Moderators Citizen Posted March 9, 2014 Moderators Posted March 9, 2014 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. 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.
Bonsai Posted March 9, 2014 Posted March 9, 2014 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.
arezu Posted March 9, 2014 Posted March 9, 2014 Use this:https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards) 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 Citizen Posted March 9, 2014 Moderators Posted March 9, 2014 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.
'LinKin Posted March 9, 2014 Author Posted March 9, 2014 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?
Saml1er Posted March 9, 2014 Posted March 9, 2014 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 Citizen Posted March 9, 2014 Moderators Posted March 9, 2014 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.
'LinKin Posted March 9, 2014 Author Posted March 9, 2014 Yea. I've done a DD kills script so it will not be so hard to do this one. Thank you guys.
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