View Single Post
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-27-2023 , 23:15   Re: Catch the event of a player untouching an entity
Reply With Quote #5

Quote:
Originally Posted by RockTheStreet View Post
Let's go from the other side.

Is there a function to check whether the player is touching the entity or not? So that the condition can check whether the player is in contact with the entity or not.
If you want to check if a certain player is not colliding with an entity simply check the player size if it is colliding with entity size...

You can do it in player prethink

PHP Code:

............

static 
Float:fOrigin1[3], Float:fOrigin2[3], Float:fMaxs1[3], Float:fMins1[3], Float:fMaxs2[3], Float:fMins2[3];
pev(idpev_originfOrigin1);
pev(idpev_maxsfMaxs1);
pev(idpev_minsfMins1);

xs_vec_add(fMaxs1fOrigin1fMaxs1);
xs_vec_add(fMins1fOrigin1fMins1);

pev(g_entitypev_originfOrigin2);
pev(g_entitypev_maxsfMaxs2);
pev(g_entitypev_minsfMins2);

xs_vec_add(fMaxs2fOrigin2fMaxs2);
xs_vec_add(fMins2fOrigin2fMins2);

if(!
BoundsIntersect(fMins1fMaxs1fMins2fMaxs2))
{
   
// Entities do not collide or touch!
}

...........

bool:BoundsIntersect(const  Float:mins1[3], const  Float:maxs1[3], const  Float:mins2[3], const Float:maxs2[3])
{
    if (
mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2])
        return 
false;
    if (
maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2])
        return 
false;
    return 
true;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-27-2023 at 23:25.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh