Dealman Posted May 24, 2013 Share Posted May 24, 2013 (edited) I've been working on a new shooter script for a while and so far all is good, however I'd like to be able to output messages. For example if you shoot a rocket, and manage to hit a player which kills him, you'd receive a message "You killed Player 2", where as Player 2 would receive a message "You were killed by Player 1". So far I haven't been able to accomplish anything. I've tried using the events onClientPlayerWasted as well as onClientProjectileCreation but I couldn't find a way to make it work. Does anyone have any good pointers as to how to go about to achieve this? If so, that would be greatly appreciated! Edited May 24, 2013 by Guest Link to comment
h4x7o0r Posted May 24, 2013 Share Posted May 24, 2013 As far as i know, you can't detect who triggered a projectile but maybe getDistanceBetweenPoints3D colshape would help u. Think that has been discussed in some previous posts like this : viewtopic.php?f=91&t=57003 Link to comment
Dealman Posted May 24, 2013 Author Share Posted May 24, 2013 As far as i know, you can't detect who triggered a projectile but maybe getDistanceBetweenPoints3D colshape would help u. Think that has been discussed in some previous posts like this : viewtopic.php?f=91&t=57003 I don't believe that is quite what I want... onClientProjectileCreation has a parameter for the creator, which I believe would be used for the "You were killed by..." message. The problem though is that I can't find a way to recognize when a player was killed by a projectile... I've also tried onClientPlayerDamage but to no avail. It might just be that I'm doing it entirely wrong Link to comment
arezu Posted May 24, 2013 Share Posted May 24, 2013 The way it's done in my server is by using onClientExplosion to get the creator of the rocket that exploded and then getDistanceBetweenPoints3D to your own vehicle and a timer to see if you died within the time it takes for a vehicle on fire to explode (in case the explosion was not a direct hit and instead caused your vehicle to start burning). Then trigger to server for syncing. This method is not the best, but its accurate enough. Link to comment
codeluaeveryday Posted November 11, 2013 Share Posted November 11, 2013 Sorry for the bump, just thought this may be useful, the first method I created and I am 100% sure of, is to use peds. When a ped dies (comits sucide) it gets the last known damage source and blames it. So we used a ped wasted event. Create peds, attach them to the vehicles, set the alpha to 0, and wait until they die. This was so accurate, we never encountered a issue with this method. This was my idea by the way. Link to comment
tosfera Posted November 11, 2013 Share Posted November 11, 2013 How about OnPlayerWasted. It returns the killer and you already got the player that died. Link to comment
codeluaeveryday Posted November 11, 2013 Share Posted November 11, 2013 How about OnPlayerWasted. It returns the killer and you already got the player that died. WTF? Dude we are talking about the race gamemode, you have no idea what your on about, and you couldn't be anymore incorrect. Goodnight all.. Link to comment
tosfera Posted November 11, 2013 Share Posted November 11, 2013 How about OnPlayerWasted. It returns the killer and you already got the player that died. WTF? Dude we are talking about the race gamemode, you have no idea what your on about, and you couldn't be anymore incorrect. Goodnight all.. Wauw, the award for biggest bitch goes to.... no not you. I've seen worse, but still. He didn't mention a shooting system in a race system, so ya. In fact, my answer would be right without knowing it is in a race gamemode. Link to comment
kevenvz Posted November 11, 2013 Share Posted November 11, 2013 Maybr setElementData(projectile,"username") on the projectile element and then add an on element player hit or something? Link to comment
Dealman Posted November 11, 2013 Author Share Posted November 11, 2013 Appreciate the answers, but I no longer need help with this. Link to comment
Spajk Posted November 11, 2013 Share Posted November 11, 2013 If you found a solution, please post it Link to comment
codeluaeveryday Posted November 12, 2013 Share Posted November 12, 2013 How about OnPlayerWasted. It returns the killer and you already got the player that died. WTF? Dude we are talking about the race gamemode, you have no idea what your on about, and you couldn't be anymore incorrect. Goodnight all.. Wauw, the award for biggest bitch goes to.... no not you. I've seen worse, but still. He didn't mention a shooting system in a race system, so ya. In fact, my answer would be right without knowing it is in a race gamemode. When a player dies in a car there is never a responsible element, this is why you attach a ped to the car and get the person who kill the ped. That's really all that's needed. Yes I am a bitch and I take full pride in it. Seriously stop replying, and how could you not know what the purpose of this resource is??? Oh wait you must not be as skilled as me I am fluent in pretty much every gamemode Except DD, my ping is too high, so it's unfair. @Keven, you can already add a projectile creator with the function, it sync's with element data anyway, a way to read it would be: getElementData(projectile, "creator").. 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