'LinKin Posted March 9, 2014 Share 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. Link to comment
Bonsai Posted March 9, 2014 Share 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 Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share 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" Link to comment
Saml1er Posted March 9, 2014 Share Posted March 9, 2014 getProjectileTarget() hmmm? Did try to use this? Link to comment
arezu Posted March 9, 2014 Share Posted March 9, 2014 Use this: https://wiki.multitheftauto.com/wiki/OnClientVehicleDamage (MTA 1.3.5 and forwards) Link to comment
Saml1er Posted March 9, 2014 Share 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. Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share 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 ... Link to comment
Saml1er Posted March 9, 2014 Share 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. Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share 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. Link to comment
Bonsai Posted March 9, 2014 Share 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. Link to comment
arezu Posted March 9, 2014 Share 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. Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share 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. Link to comment
'LinKin Posted March 9, 2014 Author Share 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? Link to comment
Saml1er Posted March 9, 2014 Share 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. Link to comment
Moderators Citizen Posted March 9, 2014 Moderators Share 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. Link to comment
'LinKin Posted March 9, 2014 Author Share 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. 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