Raised This Month: $ Target: $400
 0% 

Catch when player touches a wall which blocks you


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2010 , 14:51   Catch when player touches a wall which blocks you
Reply With Quote #1

Title? :-/
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-29-2010 , 14:52   Re: Catch when player touches a wall, but not the floor
Reply With Quote #2

Hook player touch and check if player is on ground or was on ground.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2010 , 15:01   Re: Catch when player touches a wall, but not the floor
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
Hook player touch and check if player is on ground or was on ground.
That wont work.

What will happen when I touch a wall on mid-air?
What will happen when I touch a wall on ground?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-29-2010 , 15:33   Re: Catch when player touches a wall, but not the floor
Reply With Quote #4

Why do you want to detect that ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-29-2010 , 15:54   Re: Catch when player touches a wall, but not the floor
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Why do you want to detect that ?
I'm doing something like l4d's charger infected. The only thing that I want to do is to catch when while charging he touches a wall for stopping his speed boost.

Another good way that I was thinking is to detect if something is in front of him... but this didn't worked at all:

PHP Code:
register_touch("player""*""fw_Player_Touch")
public 
fw_Player_Touch(iIdiOther)
{
    if(
g_bIsAlive[iId] && g_bBoostActivated[iId] && !IsAlive(iOther))
    {
        
// debug print added here, it's called correctly.
        
static Float:vecOrigin[3], Float:vecDirection[3]
        
entity_get_vector(iIdEV_VEC_originvecOrigin)
        
velocity_by_aim(iId16vecDirection// a little bit ahead him
        
xs_vec_add(vecOriginvecDirectionvecOrigin)
        
        
engfunc(EngFunc_TraceHullvecOriginvecOrigin0HULL_HUMAN /* or HULL_HEAD? */iId0)
    
        if(
get_tr2(0TR_StartSolid) || get_tr2(0TR_AllSolid) || !get_tr2(0TR_InOpen))
        {
                
// Disabling...
        
}
    }

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
madeitout
Member
Join Date: Jun 2008
Old 12-31-2010 , 12:39   Re: Catch when player touches a wall, but not the floor
Reply With Quote #6

maybe calculate the distance to the floor

PHP Code:
stock Float:fm_distance_to_floor(indexignoremonsters 1) {
    new 
Float:start[3], Float:dest[3], Float:end[3];
    
pev(indexpev_originstart);
    
dest[0] = start[0];
    
dest[1] = start[1];
    
dest[2] = -8191.0;

    
engfunc(EngFunc_TraceLinestartdestignoremonstersindex0);
    
get_tr2(0TR_vecEndPosend);

    
pev(indexpev_absminstart);
    new 
Float:ret start[2] - end[2];

    return 
ret ret 0.0;

__________________
madeitout is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 03-09-2011 , 16:15   Re: Catch when player touches a wall, but not the floor
Reply With Quote #7

Bump.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
frk_14
Senior Member
Join Date: Jan 2009
Location: Argentina
Old 03-10-2011 , 15:03   Re: Catch when player touches a wall, but not the floor
Reply With Quote #8

why dont check the velocity before set it?
and if touch a another player(not "catched") boost again :S
try use a task or another method to ignore the first touch to remove the boost.

Last edited by frk_14; 03-10-2011 at 15:15.
frk_14 is offline
Send a message via MSN to frk_14 Send a message via Skype™ to frk_14
madeitout
Member
Join Date: Jun 2008
Old 03-11-2011 , 11:45   Re: Catch when player touches a wall, but not the floor
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define MAX_DISTANCE_ALLOWED    20.0

new Maxplayers;

public 
plugin_init()
{
    
register_forward(FM_Touch"fw_touch");
    
Maxplayers get_maxplayers();
}

public 
fw_touch(ident)
    if (
<= id <= Maxplayers && !(<= ent <= Maxplayers))
        if (
fm_distance_to_floor(id))
        {
            
client_print(idprint_center"You are touching a wall and not the ground");

            
set_pev(idpev_gravity0.0001);
            
set_task(1.0"reset_grav"id);
        }

public 
reset_grav(id)
    
set_pev(idpev_gravity1.0);

stock Float:fm_distance_to_floor(index)
{
    static 
Float:start[3], Float:dest[3], Float:end[3];
    
pev(indexpev_originstart);
    
dest start;
    
dest[2] = -8191.0;

    
engfunc(EngFunc_TraceLinestartdest1index0);
    
get_tr2(0TR_vecEndPosend);

    
pev(indexpev_absminstart);
    return (
start[2] - end[2] > MAX_DISTANCE_ALLOWED) ? 1.0 0.0;

__________________
madeitout is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 03-11-2011 , 14:24   Re: Catch when player touches a wall, but not the floor
Reply With Quote #10

Quote:
Originally Posted by madeitout View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>
 
#define MAX_DISTANCE_ALLOWED    20.0
 
new Maxplayers;
 
public 
plugin_init()
{
    
register_forward(FM_Touch"fw_touch");
    
Maxplayers get_maxplayers();
}
 
public 
fw_touch(ident)
    if (
<= id <= Maxplayers && !(<= ent <= Maxplayers))
        if (
fm_distance_to_floor(id))
        {
            
client_print(idprint_center"You are touching a wall and not the ground");
 
            
set_pev(idpev_gravity0.0001);
            
set_task(1.0"reset_grav"id);
        }
 
public 
reset_grav(id)
    
set_pev(idpev_gravity1.0);
 
stock Float:fm_distance_to_floor(index)
{
    static 
Float:start[3], Float:dest[3], Float:end[3];
    
pev(indexpev_originstart);
    
dest start;
    
dest[2] = -8191.0;
 
    
engfunc(EngFunc_TraceLinestartdest1index0);
    
get_tr2(0TR_vecEndPosend);
 
    
pev(indexpev_absminstart);
    return (
start[2] - end[2] > MAX_DISTANCE_ALLOWED) ? 1.0 0.0;

This is not a right way when player jump then he is 1sec in air
.Dare Devil. is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:57.


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