AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stuck in wall detection (https://forums.alliedmods.net/showthread.php?t=22598)

alien 12-30-2005 18:48

Stuck in wall detection
 
Hi,

im looking for function that will safely detect when player is stucked in wall, floor or any solid object. I was considering obtaining player's position, pushing a client cmd +forward, and again obtaining position and compare them. But it always worth to ask here. Can u please help me?

Thnks in advance.

slmclarengt 12-30-2005 19:08

This should work:

Code:
public posChange(id)     {     if ( !is_user_alive(id) )         return         get_user_origin(id, glastPosition[id])         new Float:velocity[3]     entity_get_vector(id, EV_VEC_velocity, velocity)         if ( velocity[0]==0.0 && velocity[1]==0.0 ) // make them jump         {         velocity[0] += 30.00         velocity[2] += 100.0         entity_set_vector(id, EV_VEC_velocity, velocity)     }         new origin[3]     get_user_origin(id, origin)         if ( glastPosition[id][0] == origin[0] && glastPosition[id][1] == origin[1] && glastPosition[id][2] == origin[2] && is_user_alive(id) )         {         // your code here (punishment for being stuck in wall)     } }

Adapted from Superhero Casper

alien 12-30-2005 19:57

Thank you. I'll try. :)


All times are GMT -4. The time now is 16:00.

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