AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Semiclip Help - Only when player is above? (https://forums.alliedmods.net/showthread.php?t=172521)

joshknifer 11-21-2011 18:03

Semiclip Help - Only when player is above?
 
Seems like there are a lot of semiclip requests today. this came up in suggestions/requests: Somebody wants to block players from standing on top of each other, but would still want them to block other players. So it seems like this would be a modified version of a semi clip. I was trying to understand the get_user_origin function, but am having trouble. Any suggestions?

Sylwester 11-21-2011 21:14

Re: Semiclip Help - Only when player is above?
 
search for anti-boost

joshknifer 11-22-2011 12:31

Re: Semiclip Help - Only when player is above?
 
cool thanks for the right keywords. my brain was stuck in semiclip mode...

Anyways, here is the link for the solution for anybody else looking.

http://forums.alliedmods.net/showpos...8&postcount=11

Edit: Tried to compile and received this error:
/tmp/textRSwiQW.sma(26) : error 001: expected token: ")", but found "{"

Anybody see where the mistake is?

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new Float:g_ground_origin[33][3];

new 
g_max_players;

public 
plugin_init()
{
    
register_plugin("No Boosting T's""0.1""Exolent");
    
    
register_forward(FM_Touch"FwdTouch");
    
register_forward(FM_PlayerPreThink"FwdPlayerPreThink");
    
    
g_max_players global_get(glb_maxClients);
}

public 
FwdTouch(boosterplr)
{
    if( !
pev_valid(booster) || !pev_valid(plr)
    || !(
booster <= g_max_players) || !(plr <= g_max_players)
    || !
is_user_alive(booster || !is_user_alive(plr) )
    {
        return;
    }
    
    new 
CsTeams:plr_team cs_get_user_team(plr);
    
    if( 
cs_get_user_team(booster) != plr_team
    
|| plr_team != CS_TEAM_T )
    {
        return;
    }
    
    new 
Float:booster_origin[3], Float:plr_origin[3];
    
pev(boosterpev_originbooster_origin);
    
pev(plrpev_originplr_origin);
    
    if( !(
49.0 < (plr_origin[2] - booster_origin[2]) < 73.0) )
    {
        return;
    }
    
    if( 
pev(plrpev_flags)&FL_DUCKING )
    {
        
g_ground_origin[plr][2] -= 18.0;
    }
    
    
set_pev(plrpev_origing_ground_origin[plr]);
}

public 
FwdPlayerPreThink(plr)
{
    if( 
is_user_alive(plr) && pev(plrpev_flags)&FL_ONGROUND )
    {
        
pev(plrpev_origing_ground_origin[plr]);
    }


Edit 2: Nevermind, found error

Change this:
PHP Code:

|| !is_user_alive(booster || !is_user_alive(plr) ) 

To this:
PHP Code:

|| !is_user_alive(booster) || !is_user_alive(plr) ) 

So working code is:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

new Float:g_ground_origin[33][3];

new 
g_max_players;

public 
plugin_init()
{
    
register_plugin("No Boosting T's""0.1""Exolent");
    
    
register_forward(FM_Touch"FwdTouch");
    
register_forward(FM_PlayerPreThink"FwdPlayerPreThink");
    
    
g_max_players global_get(glb_maxClients);
}

public 
FwdTouch(boosterplr)
{
    if( !
pev_valid(booster) || !pev_valid(plr)
    || !(
booster <= g_max_players) || !(plr <= g_max_players)
    || !
is_user_alive(booster) || !is_user_alive(plr) )
    {
        return;
    }
    
    new 
CsTeams:plr_team cs_get_user_team(plr);
    
    if( 
cs_get_user_team(booster) != plr_team
    
|| plr_team != CS_TEAM_T )
    {
        return;
    }
    
    new 
Float:booster_origin[3], Float:plr_origin[3];
    
pev(boosterpev_originbooster_origin);
    
pev(plrpev_originplr_origin);
    
    if( !(
49.0 < (plr_origin[2] - booster_origin[2]) < 73.0) )
    {
        return;
    }
    
    if( 
pev(plrpev_flags)&FL_DUCKING )
    {
        
g_ground_origin[plr][2] -= 18.0;
    }
    
    
set_pev(plrpev_origing_ground_origin[plr]);
}

public 
FwdPlayerPreThink(plr)
{
    if( 
is_user_alive(plr) && pev(plrpev_flags)&FL_ONGROUND )
    {
        
pev(plrpev_origing_ground_origin[plr]);
    }




All times are GMT -4. The time now is 08:32.

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