Raised This Month: $12 Target: $400
 3% 

Anti Helicopter-Blocking


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
nacho312
Member
Join Date: Mar 2020
Old 09-14-2020 , 14:57   Re: Anti Helicopter-Blocking
Reply With Quote #20

Quote:
Originally Posted by tarsisd2 View Post
this is it, the plugin fixes the player blocking moving platforms like func_tracktrain. If the plugin detects a blockage, it gently moves the player to the side and the platform continues to move. The plugin was written for the Zombie Escape mod, where players often manage to block the helicopter.

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

#if AMXX_VERSION_NUM < 183
    #define NULL_VECTOR {0.0, 0.0, 0.0}
#endif

enum _:XYZ Float:XFloat:YFloat:}

new const 
Float:g_fSize[][XYZ] = {
    {
0.02.00.0}, {0.0, -2.00.0}, {2.00.00.0}, {-2.00.00.0}
}

new 
g_Cvar_TraceMode
new bool:g_bSemiclipFound

/* -------------------- */

public plugin_init() {
    
register_plugin("AutoUnstuck""0.2""alliedmodders")
    
RegisterHam(Ham_Blocked"func_tracktrain""OnBlocked_Pre")

    
bind_pcvar_num(create_cvar("amx_unstuck_trace_mode""-1"), g_Cvar_TraceMode)

    
g_bSemiclipFound = (get_cvar_pointer("resemiclip_version") != 0)
}

/* -------------------- */

public OnBlocked_Pre(pBlockedpBlocker) {
    if(
is_user_alive(pBlocker)) {
        
// unstuck in next frame as EngFunc_SetOrigin won't work in this frame (even if superceded, even in post)
        
RequestFrame("func_Unstuck"pBlocker)
    }
}

/* -------------------- */

public func_Unstuck(pBlocker) {
    if(!
is_user_alive(pBlocker)) {
        return
    }

    new 
Float:fOrigin[XYZ], Float:fMins[XYZ], Float:fVec[XYZ], iHull

    pev
(pBlockerpev_originfOrigin)

    
iHull = (pev(pBlockerpev_flags) & FL_DUCKING) ? HULL_HEAD HULL_HUMAN;

    
pev(pBlockerpev_minsfMins)

    for(new 
asizeof(g_fSize); a++) {
        
fVec[X] = fOrigin[X] - fMins[X] * g_fSize[a][X]
        
fVec[Y] = fOrigin[Y] - fMins[Y] * g_fSize[a][Y]
        
fVec[Z] = fOrigin[Z] - fMins[Z] * g_fSize[a][Z]

        if(
is_hull_vacant(fVeciHullpBlocker)) {
            
//client_print(pBlocker, print_chat, "[%i] Unstuck %i", a, random_num(0, 9999))
            
engfunc(EngFunc_SetOriginpBlockerfVec)
            
set_pev(pBlockerpev_velocityNULL_VECTOR)
            return
        }
    }

    
user_kill(pBlocker)
}

/* -------------------- */

stock bool:is_hull_vacant(const Float:fOrigin[XYZ], iHullpPlayer) {
    new 
iTraceResult

    engfunc
(EngFunc_TraceHullfOriginfOriginfunc_GetTraceMode(), iHullpPlayeriTraceResult)

    return (!
get_tr2(iTraceResultTR_StartSolid) || !get_tr2(iTraceResultTR_AllSolid))
}

/* -------------------- */

func_GetTraceMode() {
    switch(
g_Cvar_TraceMode) {
        case -
1: return g_bSemiclipFound IGNORE_MONSTERS DONT_IGNORE_MONSTERS;
        case 
0: return DONT_IGNORE_MONSTERS
        
case 1: return IGNORE_MONSTERS
    
}

    return 
IGNORE_MONSTERS

Thanks alot, a good plugin aswell from your part.


Quote:
Originally Posted by DJEarthQuake View Post
@nacho312. It's all good. At least you got what you wanted from some real Zombie connoisseurs. I've only played plague and loved it. Title is Anti Helicopter-Blocking. Why not update it to something about Zombie Escape please?
Yes, I got what I was looking for, about the tittle, yes, why not in next times, but I've never seen other mods with moving helicopters to escape lol, that was explained in the thread.
Thanks @DJEarthQuake
nacho312 is offline
 


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 05:08.


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