AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   team Semiclip wont work.. (https://forums.alliedmods.net/showthread.php?t=249978)

hannes 10-15-2014 15:46

team Semiclip wont work..
 
I dont get the team semiclip to work could i get some help here?
I know this looks like a mess :grrr::grrr:
PHP Code:

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

#define NAME_LENGH    32
#define STRIP_ENTITIES    9
#define XO_PLAYER 5
#define m_iTeam 114
#define OFFSET_INTERNALMODEL 126

#define cs_get_user_team_index(%0)    get_pdata_int(%0, m_iTeam, XO_PLAYER)

new const VERSION[] = "0.0.1"

const XTRA_OFS_PLAYER 5
const m_pActiveItem 373

const Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new HamHook:g_iHhResetMaxSpeed

new g_msgStatusIconamx_gamenamegMaxClientspCvarTime;

new 
bool:g_bAlive[33];
new 
bool:g_bSolid[33];

new 
hns_semiclip;
new 
hns_semiclip_alpha;

new 
CsTeams:g_Team[33];

new 
g_MaxPlayers;
new 
g_iMaxAppearances 4
new g_iTeamInfo

enum
{
    
TEAM_UNASSIGNED,
    
TEAM_TERRORIST,
    
TEAM_CT,
    
TEAM_SPECTATOR
}

new const 
g_szTeamNames[][] = 
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

enum
{
    
CT_URBAN 1,
    
T_TERROR 2,
    
T_LEET 3,
    
T_ARCTIC 4,
    
CT_GSG9 5,
    
CT_GIGN 6,
    
CT_SAS 7,
    
T_GUERILLA 8,
    
CT_VIP 9,
    
T_MILITIA 10,
    
CT_SPETSNAZ 11
}

new const 
g_iModels[][] = 
{
    {
T_TERRORCT_URBAN},
    {
T_LEET CT_GSG9},
    {
T_LEETCT_SAS},
    {
T_GUERILLACT_GIGN},
    {
T_MILITIACT_SPETSNAZ}
}

new const 
g_szModels[][] = 
{
    
"",
    
"urban",
    
"terror",
    
"leet",
    
"arctic",
    
"gsg9",
    
"gign",
    
"sas",
    
"guerilla",
    
"vip",
    
"militia",
    
"spetsnaz"
}

new 
game_entity[STRIP_ENTITIES][] =
{
    
"func_bomb_target""func_escapezone""func_hostage_rescue""func_vip_safetyzone",
    
"info_bomb_target""info_hostage_rescue","info_vip_start""hostage_entity",
    
"monster_scientist"
}

public 
plugin_init()
{
    
register_plugin("HideNSeek"VERSION"MENIE PPL")

    
register_event("SendAudio""Event_SendAudio_MRAD_ctwin""a""2&%!MRAD_ctwin")
    new 
szModName[6]
    
get_modname(szModNamecharsmax(szModName))
    
    if( 
equal(szModName"czero") )
    {
        
g_iMaxAppearances 5
    
}
    
g_iTeamInfo get_user_msgid("TeamInfo")
    
    
g_iHhResetMaxSpeed RegisterHam(Ham_Player_ResetMaxSpeed"player""CBasePlayer_ResetMaxSpeed")

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
    
//Strip
    
RegisterHamHam_Spawn"player""Spawn"
    
//Block Weaponbox
    
RegisterHamHam_Touch"weaponbox""WeaponBox_Touch");
    
    
// Block BuyZone
    
g_msgStatusIcon get_user_msgid("StatusIcon");
    
register_message(g_msgStatusIcon"msgStatusIcon");
    
    
//Gamename
    
amx_gamename register_cvar("hns_gamename"".se|HideNSeek");
    
register_forward(FM_GetGameDescription"fwGetGameDescription");
    
//Team semiclip
    
register_forward(FM_StartFrame"fwd_startframe");
    
    
pCvarTime register_cvar"dw_time""0" );
    
gMaxClients get_maxplayers();
    
    
hns_semiclip register_cvar("hns_semiclip""1"00.0);
    
hns_semiclip_alpha register_cvar("hns_semiclip_alpha""127"00.0);
}


public 
fwdPlayerPreThink(plr)
{
    new 
semiclip get_pcvar_num(hns_semiclip);
    
    if( 
g_bAlive[plr] )
    {
        new 
CsTeams:team cs_get_user_team(plr);
        if( 
semiclip )
        {
            
            new 
targetbody;
            
get_user_aiming(plrtargetbody9999);
            
            if( 
target <= g_MaxPlayers && g_bAlive[target] )
            {
                new 
CsTeams:targetTeam cs_get_user_team(target);
                if( 
semiclip == || targetTeam == team )
                {
                    new 
sName[32];
                    
get_user_name(targetsName31);
                    
                    new 
sMessage[64];
                    if( 
targetTeam == team )
                    {
                        
formatex(sMessage63"Friend: %s^nHealth: %i"sNameget_user_health(target));
                    }
                    else
                    {
                        
formatex(sMessage63"Enemy: %s"sName);
                    }
                    
                    if( 
targetTeam == CS_TEAM_CT )
                    {
                        
set_hudmessage(063127, -1.0, -1.000.00.10.00.0, -1);
                    }
                    else if( 
targetTeam == CS_TEAM_T )
                    {
                        
set_hudmessage(12700, -1.0, -1.000.00.10.00.0, -1);
                    }
                    
                    
show_hudmessage(plr"%s"sMessage);
                }
            }
        }
    }

}

public 
fwdAddToFullPackPost(eseenthosthostflagsplayerpSet)
{
    if( 
player )
    {
        if( 
g_bSolid[host] && g_bSolid[ent] )
        {
            new 
semiclip get_pcvar_num(hns_semiclip);
            if( 
semiclip == || g_Team[host] == g_Team[ent] )
            {
                
set_es(esES_SolidSOLID_NOT);
                
                static 
Float:fOldAlpha;
                
                new 
Float:fAlpha get_pcvar_float(hns_semiclip_alpha);
                if( 
fAlpha 255.0 )
                {
                    
set_es(esES_RenderModekRenderTransAlpha);
                    
set_es(esES_RenderAmtfAlpha);
                }
                else if( 
fOldAlpha 255.0 )
                {
                    
set_es(esES_RenderModekRenderNormal);
                    
set_es(esES_RenderAmt16.0);
                }
                
                
fOldAlpha fAlpha;
            }
        }
    }
}

public 
Event_SendAudio_MRAD_ctwin()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"h")
    if( 
iNum )
    {
        new 
id
        
for(--iNumiNum>=0iNum--)
        {
            
id iPlayers[iNum]
            switch( 
cs_get_user_team_index(id) )
            {
                case 
TEAM_TERRORIST:SetUserTeam(idTEAM_CT)
                case 
TEAM_CT:SetUserTeam(idTEAM_TERRORIST)
            }
        }
    }
}

public 
plugin_precache()
{
    
register_forward(FM_Spawn"HBSpawn")
}

public 
Event_HLTV_New_Round()
{
    
EnableHamForwardg_iHhResetMaxSpeed )
}

public 
LogEvent_Round_Start()
{
    
DisableHamForwardg_iHhResetMaxSpeed )
    
    new 
players[32],pnumplayer;
    
get_players(players,pnum)
    for (new 
1pnumi++) 
    {
        
player players[i]
        
strip_user_weapons(player
        
give_item(player"weapon_knife"
    } 
}

public 
Spawn(id)
{
    
set_task(0.1"strip",id)
}

public 
strip(id)
{
    
strip_user_weapons(id
    
give_item(id"weapon_knife"
}
//Weaponbox
public WeaponBox_Touch ( const WeaponBox, const Other )
{
    if ( !
Other || Other gMaxClients )
    {
        
set_pevWeaponBoxpev_nextthinkget_gametime() + get_pcvar_floatpCvarTime ) );
    }
}

public 
HBSpawn(pent)
{
    if(
pev_valid(pent))
    {
        new 
classname[32]
        
pev(pentpev_classnameclassname31)
        for(new 
0STRIP_ENTITIES; ++i)    
        {
            if(
equali(classnamegame_entity[i]))
            {
            
engfunc(EngFunc_RemoveEntitypent)
            break
            }
        }
    }
}

// Block buyzone
public msgStatusIcon(msgidmsgdestid)
{
    static 
szIcon[8];
    
get_msg_arg_string(2szIcon7);
 
    if(
equal(szIcon"buyzone") && get_msg_arg_int(1))
    {
    
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
    return 
PLUGIN_HANDLED;
}
 
    return 
PLUGIN_CONTINUE;
}
//gamename
public fwGetGameDescription() {
    static 
gamename[NAME_LENGH+1];
    
get_pcvar_string(amx_gamenamegamenameNAME_LENGH);
    
forward_return(FMV_STRINGgamename);
    
    return 
FMRES_SUPERCEDE;
}  

public 
CBasePlayer_ResetMaxSpeed(id)
{
    if( 
is_user_connected(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        new 
Float:flMaxSpeed

        
new iActiveItem get_pdata_cbase(idm_pActiveItemXTRA_OFS_PLAYER)
        if( 
iActiveItem )
        {
            
ExecuteHam(Ham_CS_Item_GetMaxSpeediActiveItemflMaxSpeed)
        }
        else
        {
        
flMaxSpeed 250.0
        
}
        
set_pev(idpev_maxspeedflMaxSpeed)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}

stock fm_set_rendering(entfx=kRenderFxNoner=255g=255b=255rend=kRenderNormalamt=16)
{
    
set_pev(entpev_renderfxfx);
    
    new 
Float:rendColor[3];
    
rendColor[0] = float(r);
    
rendColor[1] = float(g);
    
rendColor[2] = float(b);
    
set_pev(entpev_rendercolorrendColor);
    
    
set_pev(entpev_rendermoderend);
    
set_pev(entpev_renderamtfloat(amt));
}

SetUserTeam(idiTeam)
{
    
set_pdata_int(idm_iTeamiTeamXO_PLAYER)

    new 
iNewModel g_iModels[iTeam-1][  random(g_iMaxAppearances)  ]

    
set_pdata_int(idOFFSET_INTERNALMODELiNewModelXO_PLAYER)
    
    
set_user_info(id"model"g_szModels[iNewModel])

    
emessage_begin(MSG_ALLg_iTeamInfo)
    
ewrite_byte(id)
    
ewrite_string(g_szTeamNames[iTeam])
    
emessage_end()



wickedd 10-15-2014 18:25

Re: team Semiclip wont work..
 
There is at least 2 on the forum that works, just use one of them. Or use them as a reference.

zmd94 10-15-2014 22:36

Re: team Semiclip wont work..
 
Just try this: https://forums.alliedmods.net/showthread.php?t=137980

hannes 10-16-2014 02:31

Re: team Semiclip wont work..
 
No, i want it to work in my plugin.
Thanks anyway.

Its like lagging wen i go thru the player, could someone help? :)
PHP Code:

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

#define NAME_LENGH    32
#define STRIP_ENTITIES    9
#define XO_PLAYER 5
#define m_iTeam 114
#define OFFSET_INTERNALMODEL 126

#define cs_get_user_team_index(%0)    get_pdata_int(%0, m_iTeam, XO_PLAYER)

new const VERSION[] = "0.0.1"

const XTRA_OFS_PLAYER 5
const m_pActiveItem 373

const Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new HamHook:g_iHhResetMaxSpeed

new g_msgStatusIconamx_gamenamegMaxClientspCvarTime;

new 
g_iMaxAppearances 4
new g_iTeamInfo

new bool:plrSolid[33]
new 
bool:plrRestore[33]
new 
plrTeam[33]

new 
maxplayers

enum
{
    
TEAM_UNASSIGNED,
    
TEAM_TERRORIST,
    
TEAM_CT,
    
TEAM_SPECTATOR
}

new const 
g_szTeamNames[][] = 
{
    
"UNASSIGNED",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}

enum
{
    
CT_URBAN 1,
    
T_TERROR 2,
    
T_LEET 3,
    
T_ARCTIC 4,
    
CT_GSG9 5,
    
CT_GIGN 6,
    
CT_SAS 7,
    
T_GUERILLA 8,
    
CT_VIP 9,
    
T_MILITIA 10,
    
CT_SPETSNAZ 11
}

new const 
g_iModels[][] = 
{
    {
T_TERRORCT_URBAN},
    {
T_LEET CT_GSG9},
    {
T_LEETCT_SAS},
    {
T_GUERILLACT_GIGN},
    {
T_MILITIACT_SPETSNAZ}
}

new const 
g_szModels[][] = 
{
    
"",
    
"urban",
    
"terror",
    
"leet",
    
"arctic",
    
"gsg9",
    
"gign",
    
"sas",
    
"guerilla",
    
"vip",
    
"militia",
    
"spetsnaz"
}

new 
game_entity[STRIP_ENTITIES][] =
{
    
"func_bomb_target""func_escapezone""func_hostage_rescue""func_vip_safetyzone",
    
"info_bomb_target""info_hostage_rescue","info_vip_start""hostage_entity",
    
"monster_scientist"
}

public 
plugin_init()
{
    
register_plugin("HideNSeek"VERSION"MENIE PPL")

    
register_event("SendAudio""Event_SendAudio_MRAD_ctwin""a""2&%!MRAD_ctwin")
    new 
szModName[6]
    
get_modname(szModNamecharsmax(szModName))
    
    if( 
equal(szModName"czero") )
    {
        
g_iMaxAppearances 5
    
}
    
g_iTeamInfo get_user_msgid("TeamInfo")
    
    
g_iHhResetMaxSpeed RegisterHam(Ham_Player_ResetMaxSpeed"player""CBasePlayer_ResetMaxSpeed")

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
    
//Strip
    
RegisterHamHam_Spawn"player""Spawn"
    
//Block Weaponbox
    
RegisterHamHam_Touch"weaponbox""WeaponBox_Touch");
    
    
// Block BuyZone
    
g_msgStatusIcon get_user_msgid("StatusIcon");
    
register_message(g_msgStatusIcon"msgStatusIcon");
    
    
//Gamename
    
amx_gamename register_cvar("hns_gamename"".se|HideNSeek");
    
register_forward(FM_GetGameDescription"fwGetGameDescription");
    
//Team semiclip
    
register_forward(FM_StartFrame"fwd_startframe");
    
    
pCvarTime register_cvar"dw_time""0" );
    
gMaxClients get_maxplayers();
    
    
register_forward(FM_PlayerPreThink"preThink")
    
register_forward(FM_PlayerPostThink"postThink")
    
register_forward(FM_AddToFullPack"addToFullPack"1)
    
    
maxplayers get_maxplayers()
}

public 
Event_SendAudio_MRAD_ctwin()
{
    new 
iPlayers[32], iNum
    get_players
(iPlayersiNum"h")
    if( 
iNum )
    {
        new 
id
        
for(--iNumiNum>=0iNum--)
        {
            
id iPlayers[iNum]
            switch( 
cs_get_user_team_index(id) )
            {
                case 
TEAM_TERRORIST:SetUserTeam(idTEAM_CT)
                case 
TEAM_CT:SetUserTeam(idTEAM_TERRORIST)
            }
        }
    }
}

FirstThink()
{
    for(new 
1<= maxplayersi++)
    {
        if(!
is_user_alive(i))
        {
            
plrSolid[i] = false
            
continue
        }
        
        
plrTeam[i] = get_user_team(i)
        
plrSolid[i] = pev(ipev_solid) == SOLID_SLIDEBOX true false
    
}
}

public 
preThink(id)
{
    static 
iLastThink
    
    
if(LastThink id)
    {
        
FirstThink()
    }
    
LastThink id

    
    
if(!plrSolid[id]) return
    
    for(
1<= maxplayersi++)
    {
        if(!
plrSolid[i] || id == i) continue
        
        if(
plrTeam[i] == plrTeam[id])
        {
            
set_pev(ipev_solidSOLID_NOT)
            
plrRestore[i] = true
        
}
    }
}

public 
postThink(id)
{
    static 
i
    
    
for(1<= maxplayersi++)
    {
        if(
plrRestore[i])
        {
            
set_pev(ipev_solidSOLID_SLIDEBOX)
            
plrRestore[i] = false
        
}
    }
}

public 
plugin_precache()
{
    
register_forward(FM_Spawn"HBSpawn")
}

public 
Event_HLTV_New_Round()
{
    
EnableHamForwardg_iHhResetMaxSpeed )
}

public 
LogEvent_Round_Start()
{
    
DisableHamForwardg_iHhResetMaxSpeed )
    
    new 
players[32],pnumplayer;
    
get_players(players,pnum)
    for (new 
1pnumi++) 
    {
        
player players[i]
        
strip_user_weapons(player
        
give_item(player"weapon_knife"
    } 
}

public 
Spawn(id)
{
    
set_task(0.1"strip",id)
}

public 
strip(id)
{
    
strip_user_weapons(id
    
give_item(id"weapon_knife"
}
//Weaponbox
public WeaponBox_Touch ( const WeaponBox, const Other )
{
    if ( !
Other || Other gMaxClients )
    {
        
set_pevWeaponBoxpev_nextthinkget_gametime() + get_pcvar_floatpCvarTime ) );
    }
}

public 
HBSpawn(pent)
{
    if(
pev_valid(pent))
    {
        new 
classname[32]
        
pev(pentpev_classnameclassname31)
        for(new 
0STRIP_ENTITIES; ++i)    
        {
            if(
equali(classnamegame_entity[i]))
            {
            
engfunc(EngFunc_RemoveEntitypent)
            break
            }
        }
    }
}

// Block buyzone
public msgStatusIcon(msgidmsgdestid)
{
    static 
szIcon[8];
    
get_msg_arg_string(2szIcon7);
 
    if(
equal(szIcon"buyzone") && get_msg_arg_int(1))
    {
    
set_pdata_int(id235get_pdata_int(id235) & ~(1<<0));
    return 
PLUGIN_HANDLED;
}
 
    return 
PLUGIN_CONTINUE;
}
//gamename
public fwGetGameDescription() {
    static 
gamename[NAME_LENGH+1];
    
get_pcvar_string(amx_gamenamegamenameNAME_LENGH);
    
forward_return(FMV_STRINGgamename);
    
    return 
FMRES_SUPERCEDE;
}  

public 
CBasePlayer_ResetMaxSpeed(id)
{
    if( 
is_user_connected(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        new 
Float:flMaxSpeed

        
new iActiveItem get_pdata_cbase(idm_pActiveItemXTRA_OFS_PLAYER)
        if( 
iActiveItem )
        {
            
ExecuteHam(Ham_CS_Item_GetMaxSpeediActiveItemflMaxSpeed)
        }
        else
        {
        
flMaxSpeed 250.0
        
}
        
set_pev(idpev_maxspeedflMaxSpeed)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED
}

stock fm_set_rendering(entfx=kRenderFxNoner=255g=255b=255rend=kRenderNormalamt=16)
{
    
set_pev(entpev_renderfxfx);
    
    new 
Float:rendColor[3];
    
rendColor[0] = float(r);
    
rendColor[1] = float(g);
    
rendColor[2] = float(b);
    
set_pev(entpev_rendercolorrendColor);
    
    
set_pev(entpev_rendermoderend);
    
set_pev(entpev_renderamtfloat(amt));
}

SetUserTeam(idiTeam)
{
    
set_pdata_int(idm_iTeamiTeamXO_PLAYER)

    new 
iNewModel g_iModels[iTeam-1][  random(g_iMaxAppearances)  ]

    
set_pdata_int(idOFFSET_INTERNALMODELiNewModelXO_PLAYER)
    
    
set_user_info(id"model"g_szModels[iNewModel])

    
emessage_begin(MSG_ALLg_iTeamInfo)
    
ewrite_byte(id)
    
ewrite_string(g_szTeamNames[iTeam])
    
emessage_end()




All times are GMT -4. The time now is 17:38.

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