AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Get dead players in radius (https://forums.alliedmods.net/showthread.php?t=319561)

karaulov 11-08-2019 05:05

Get dead players in radius
 
Help m! How to get dead players in radius?! (NOT SPECTATORS!)

I tried use get_user_origin,get_players_distance, entity_get_vector( id, EV_VEC_origin

But instead origin of dead players(position of dead player body) , i got origin of spectator players(position at what dead player look at this moment)...

iNvectus 11-08-2019 10:27

Re: Get dead players in radius
 
You can try hooking when the player dies and save the origin to variable. Once you have this, you can do whatever you want with it.

karaulov 11-08-2019 10:50

Re: Get dead players in radius
 
Quote:

Originally Posted by iNvectus (Post 2672344)
You can try hooking when the player dies and save the origin to variable. Once you have this, you can do whatever you want with it.

Strange, very strange! AMXX is not present function to get real player death position ?

Impossible to get player dead body position ? :) :) :) :)

iNvectus 11-08-2019 11:08

Re: Get dead players in radius
 
And how do you find strange to get the dead player's dead body origin when he is dying? That is the regular thing to be done like this..

Code:
#include <amxmodx> new Float:g_iDeadPlayerOrigin[33][3]; public plugin_init() {     register_plugin("Test", "1.0", "invectus"); } public client_death(iKiller, iVictim, iWpnIndex, iHitPlace, iTeammateKill) {     if(!is_user_connected(iVictim))         return;     get_user_origin(iVictim, g_iDeadPlayerOrigin[iVictim], .mode = 0);     client_print(0, print_chat, "%f -- %f -- %f", g_iDeadPlayerOrigin[iVictim][0], g_iDeadPlayerOrigin[iVictim][1], g_iDeadPlayerOrigin[iVictim][2]);     return PLUGIN_HANDLED; }

karaulov 11-08-2019 12:38

Re: Get dead players in radius
 
Quote:

Originally Posted by iNvectus (Post 2672352)
And how do you find strange to get the dead player's dead body origin when he is dying? That is the regular thing to be done like this..

Code:
#include <amxmodx> new Float:g_iDeadPlayerOrigin[33][3]; public plugin_init() {     register_plugin("Test", "1.0", "invectus"); } public client_death(iKiller, iVictim, iWpnIndex, iHitPlace, iTeammateKill) {     if(!is_user_connected(iVictim))         return;     get_user_origin(iVictim, g_iDeadPlayerOrigin[iVictim], .mode = 0);     client_print(0, print_chat, "%f -- %f -- %f", g_iDeadPlayerOrigin[iVictim][0], g_iDeadPlayerOrigin[iVictim][1], g_iDeadPlayerOrigin[iVictim][2]);     return PLUGIN_HANDLED; }

But if player killed in fly ? How to get position dead body instead of "position of kill" ?

HamletEagle 11-08-2019 14:15

Re: Get dead players in radius
 
Quote:

Originally Posted by karaulov (Post 2672363)
But if player killed in fly ? How to get position dead body instead of "position of kill" ?

There is no "dead body" on the server side of things so it is natural there is not a straightforward way of doing that.

I didn't play cs in ages so I do not remember, but if a player is killed while airborne then his body will fail straight down, right? Then you just get the kill position and do a traceline downwards(from current position to a new position which has the same x, y as the kill pos and z is -9999.9).
Get the TR_vecEndPos from the traceline and you got the position where the body "landed"(assuming it goes straight down). You may want to add a small offset to the z component depending on what you will use this position for.

iNvectus 11-08-2019 14:17

Re: Get dead players in radius
 
You will have to get it grounded. Consider using this https://forums.alliedmods.net/showpo...&postcount=103

Or you can try to pev_origin X and Y, then pev_absmin on Z

karaulov 11-08-2019 14:26

Re: Get dead players in radius
 
Need just wait two second after dead message, and then get real origin of dead body!


All times are GMT -4. The time now is 18:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.