AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ H3LP ] Check player stuck (https://forums.alliedmods.net/showthread.php?t=298692)

DarthMan 06-20-2017 15:09

[ H3LP ] Check player stuck
 
Hello. How can I check if a player is stuck inside another player? I made a check but it is only for if the player stuck on ground etc. Any help would be appreciated. need this to finish the unstuck plug-in. Thanks !

gabuch2 06-20-2017 18:39

Re: [ H3LP ] Check player stuck
 
What's wrong with Ramono's Plugin?

DarthMan 06-21-2017 03:37

Re: [ H3LP ] Check player stuck
 
Quote:

Originally Posted by Gabe Iggy (Post 2530193)
What's wrong with Ramono's Plugin?

It checks only if the player is stuck inside walls or in teh ground, not inside a player.

edon1337 06-21-2017 05:19

Re: [ H3LP ] Check player stuck
 
Loop through all players and check if they have same origin?

DarthMan 06-21-2017 05:28

Re: [ H3LP ] Check player stuck
 
Quote:

Originally Posted by edon1337 (Post 2530283)
Loop through all players and check if they have same origin?

It won't work that way, cuz wut if the players have a different origin but they're still stuck, not in center? Like if a player is stuck in another player's head it would have an origin, if it is stuck in center of him another origin etc so it won't work that way.

edon1337 06-21-2017 05:36

Re: [ H3LP ] Check player stuck
 
Yeah, what about checking if they have close origins ?

DarthMan 06-21-2017 05:41

Re: [ H3LP ] Check player stuck
 
Quote:

Originally Posted by edon1337 (Post 2530292)
Yeah, what about checking if they have close origins ?

Ik how to check for same origin, just pev both origins of the players using pev then if origin of player a equals origin of player b, but how can I check for closer origins? Btw I am using a modified version of Arkshine's unstick plug-in, since I'm not the best at advanced calculations, but I modified it a bit and also made a stock that uses trace hull.

edon1337 06-21-2017 05:58

Re: [ H3LP ] Check player stuck
 
I'm not good at calculations either but I hope this can lead you somewhere lol. Basically I'm hooking Ham_Touch and checking if Touched player's origin minus Toucher player's origin is less or equal to 10 (that should be enough to confirm they're stuck). I'm not sure which dimension of array I should check though..
Code:
#include < amxmodx > #include < hamsandwich > #include < engine > #define MIN_DISTANCE 10.0 public plugin_init( ) {     RegisterHam( Ham_Touch, "player", "fw_HamTouchPost", 1 ) ; } public fw_HamTouchPost( iTouched, iToucher ) {     new Float:iTouchedOrigin[ 3 ], Float:iToucherOrigin[ 3 ] ;     entity_get_vector( iTouched, EV_VEC_origin, iTouchedOrigin ) ;     entity_get_vector( iTouched, EV_VEC_origin, iToucherOrigin ) ;     if( floatabs ( ( iTouchedOrigin[ 1 ] - iToucherOrigin[ 1 ] ) ) <= MIN_DISTANCE ) {         // stuck     }     return HAM_IGNORED ; }

jimaway 06-21-2017 06:16

Re: [ H3LP ] Check player stuck
 
Quote:

Originally Posted by DarthMan (Post 2530261)
It checks only if the player is stuck inside walls or in teh ground, not inside a player.

it definitely should work with players.

DarthMan 06-21-2017 06:26

Re: [ H3LP ] Check player stuck
 
Quote:

Originally Posted by edon1337 (Post 2530299)
I'm not good at calculations either but I hope this can lead you somewhere lol. Basically I'm hooking Ham_Touch and checking if Touched player's origin minus Toucher player's origin is less or equal to 10 (that should be enough to confirm they're stuck). I'm not sure which dimension of array I should check though..
Code:
#include < amxmodx > #include < hamsandwich > #include < engine > #define MIN_DISTANCE 10.0 public plugin_init( ) {     RegisterHam( Ham_Touch, "player", "fw_HamTouchPost", 1 ) ; } public fw_HamTouchPost( iTouched, iToucher ) {     new Float:iTouchedOrigin[ 3 ], Float:iToucherOrigin[ 3 ] ;     entity_get_vector( iTouched, EV_VEC_origin, iTouchedOrigin ) ;     entity_get_vector( iTouched, EV_VEC_origin, iToucherOrigin ) ;     if( floatabs ( ( iTouchedOrigin[ 1 ] - iToucherOrigin[ 1 ] ) ) <= MIN_DISTANCE ) {         // stuck     }     return HAM_IGNORED ; }

Thanks, will check it out :)


All times are GMT -4. The time now is 22:46.

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