/* Formatright © 2009, ConnorMcLeod
Team SemiClip is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Team SemiClip; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new const VERSION[] = "0.0.2" // 22jan2010
const MAX_PLAYERS = 32
new g_bAlive
#define MarkUserAlive(%1) g_bAlive |= 1<<(%1 & 31)
#define ClearUserAlive(%1) g_bAlive &= ~( 1<<(%1 & 31) )
#define IsAlive(%1) g_bAlive & 1<<(%1 & 31)
new g_iTeam[MAX_PLAYERS+1]
new const g_szTeams[][] = {
"",
"TERRORIST",
"CT",
""
}
enum {
_T = 1,
_CT
}
new g_iTeamSemiclip = _T | _CT
public plugin_init()
{
register_plugin("Team SemiClip", VERSION, "ConnorMcLeod")
RegisterHam(Ham_Spawn, "player", "Ham_CBasePlayer_Spawn_Post", 1)
RegisterHam(Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", 1)
register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
register_concmd("team_semiclip", "ConsoleCommand_TeamSemiclip", ADMIN_CFG)
}
public ConsoleCommand_TeamSemiclip( id , level , cid )
{
if( cmd_access(id, level, cid, 2) )
{
new szArg[2]
read_argv(1, szArg, charsmax(szArg))
g_iTeamSemiclip = clamp(str_to_num(szArg), 0, 3)
}
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
ClearUserAlive(id)
}
public client_disconnect( id )
{
ClearUserAlive(id)
}
public Ham_CBasePlayer_Spawn_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
g_iTeam[id] = get_pdata_int(id, m_iTeam, XTRA_OFS_PLAYER)
}
else
{
ClearUserAlive(id)
}
}
public Ham_CBasePlayer_Killed_Post( id )
{
if( is_user_alive(id) )
{
MarkUserAlive(id)
}
else
{
ClearUserAlive(id)
}
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
if( player
&& id != iEnt
&& IsAlive(id)
&& g_iTeamSemiclip & g_iTeam[id]
&& IsAlive(iEnt)
&& g_iTeam[id] == g_iTeam[iEnt]
&& get_orig_retval() )
{
set_es(es, ES_Solid, SOLID_NOT)
set_es(es, ES_RenderMode, kRenderTransAlpha)
set_es(es, ES_RenderAmt, 250)
}
}
public Ham_CBasePlayer_PreThink_Post(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer <---- Line 136
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_NOT)
}
}
}
public client_PostThink(id)
{
if( IsAlive(id) == 0 || !(g_iTeamSemiclip & g_iTeam[id]) )
{
return
}
new iPlayers[MAX_PLAYERS], iNum, iPlayer LINE <--- 156
get_players(iPlayers, iNum, "ae", g_szTeams[g_iTeam[id]])
for(new i; i<iNum; i++)
{
iPlayer = iPlayers[i]
if( id != iPlayer )
{
entity_set_int(iPlayer, EV_INT_solid, SOLID_SLIDEBOX)
}
}
}
__________________
|