Kod: Tümünü seç
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Gorunmezlik"
#define VERSION "1.0"
#define AUTHOR "PaZee"
new g_iInvisFactor = 1
new Trie:g_tPreventEntityKeyvalue
new CsTeams:g_iFuriensTeam = CS_TEAM_T
public plugin_precache()
{
if( !ReadCfgFile() )
{
log_amx("Configuration file doesn't exist !!")
}
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
new iEnt
iEnt = create_entity("info_target")
set_pev(iEnt, pev_classname, "check_speed")
set_pev(iEnt, pev_nextthink, get_gametime() + 0.1)
register_think("check_speed", "Set_Furiens_Visibility")
}
ReadCfgFile()
{
new szConfigFile[128]
get_localinfo("amxx_configsdir", szConfigFile, charsmax(szConfigFile))
format(szConfigFile, charsmax(szConfigFile), "%s/furien/furien.ini", szConfigFile);
new fp = fopen(szConfigFile, "rt")
if( !fp )
{
return 0
}
new szDatas[96], szKey[32], szValue[64]
while( !feof(fp) )
{
fgets(fp, szDatas, charsmax(szDatas))
trim(szDatas)
if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
{
continue
}
if( parse(szDatas, szKey, charsmax(szKey), szValue, charsmax(szValue)) < 2 || szValue[0] == 0 )
{
continue
}
switch( szKey[0] )
{
case 'H':
{
if( equal(szKey, "HOSTAGE_REMOVE") && str_to_num(szValue) )
{
RegisterHam(Ham_Spawn, "hostage_entity", "Hostage_Spawn")
}
}
case 'I':
{
if( equal(szKey, "INVIS_FACTOR") )
{
g_iInvisFactor = clamp(str_to_num(szValue), 1, 4)
}
}
}
}
fclose( fp )
return 1
}
public pfn_keyvalue( iEnt )
{
if( g_tPreventEntityKeyvalue )
{
new szClassName[32], szCrap[2]
copy_keyvalue(szClassName, charsmax(szClassName), szCrap, charsmax(szCrap), szCrap, charsmax(szCrap))
if( TrieKeyExists(g_tPreventEntityKeyvalue, szClassName) )
{
remove_entity(iEnt)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public plugin_cfg()
{
if( g_tPreventEntityKeyvalue )
{
TrieDestroy(g_tPreventEntityKeyvalue)
set_cvar_float("sv_restart", 1.0)
}
}
public Set_Furiens_Visibility( iEnt ) {
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1)
new iPlayers[32], iNum, id, Float:fVecVelocity[3], iSpeed
get_players(iPlayers, iNum, "ae", g_iFuriensTeam == CS_TEAM_T ? "TERRORIST" : "CT")
for(new i; i<iNum; i++)
{
id = iPlayers[i]
if( get_user_weapon(id) == CSW_KNIFE )
{
entity_get_vector(id, EV_VEC_velocity, fVecVelocity)
iSpeed = floatround( vector_length(fVecVelocity) )
if( iSpeed < g_iInvisFactor*255 )
{
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, iSpeed/g_iInvisFactor)
}
else
{
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}
}
else
{
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}
}
}
public Hostage_Spawn( iHostage )
{
remove_entity(iHostage)
return HAM_SUPERCEDE
}