AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with Hologram Code (https://forums.alliedmods.net/showthread.php?t=233586)

wAyz 01-17-2014 06:38

Help with Hologram Code
 
Hello,

I'm using this code by ConnorMcLeod.

Code:

#include <amxmodx>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

new const VERSION[] = "0.7.0"

const MAX_PLAYERS = 32

new g_iPlayers[MAX_PLAYERS], g_iNum, g_iPlayer, i
new const g_szAliveFlags[] = "a"
#define RefreshPlayersList()    get_players(g_iPlayers, g_iNum, g_szAliveFlags)

public plugin_init()


{   

    register_plugin("Hologram", VERSION, "ConnorMcLeod")

    register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)

    RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
}



public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
    if( player && id != iEnt && get_orig_retval() && is_user_alive(id) )
    {
        set_es(es, ES_Solid, SOLID_NOT)

        set_es(es, ES_RenderMode, kRenderTransAdd)
        set_es(es, ES_RenderAmt, 80)
        set_es(es, ES_RenderColor, 0, 0, 0)
        set_es(es, ES_RenderFx, kRenderFxDistort)
    }
}

public Ham_CBasePlayer_PreThink_Post(id)
{
    if( !is_user_alive(id) )
    {
        return
    }

    RefreshPlayersList()

    for(i = 0; i<g_iNum; i++)
    {
        g_iPlayer = g_iPlayers[i]
        if( id != g_iPlayer )
        {
            set_pev(g_iPlayer, pev_solid, SOLID_NOT)
        }
    }
}

public client_PostThink(id)
{
    if( !is_user_alive(id) )
    {
        return
    }

    RefreshPlayersList()

    for(i = 0; i<g_iNum; i++)
    {
        g_iPlayer = g_iPlayers[i]
        if( g_iPlayer != id )
        {
            set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
        }
    }
}

Would it be possible to make this code only affect on Spectators? That would be a cool
feature for my HNS Server (Spectators wouldn't block other players).
I will have to include <cstrike> and using cs_get_user_team but I don't know exactly where to put it.
Maybe ConnorMcLeod or some other guy knows.


All times are GMT -4. The time now is 10:15.

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