#define USE_KZ_ARG
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN_TAG "Kz"
#if defined USE_KZ_ARG
#include <kzarg>
#endif
#define PLUGIN "NoClip"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"
#define MAX_PLAYERS 32
#define m_pPlayer 41
#define m_pActiveItem 373
new g_bNoClip[MAX_PLAYERS+1]
new g_pCvarSpeed
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pCvarSpeed = register_cvar("amx_noclip_speed", "320")
RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
new szWeapon[20]
for(new i=1; i<=CSW_P90; i++)
{
if( get_weaponname(i, szWeapon, charsmax(szWeapon)) )
{
RegisterHam(Ham_CS_Item_GetMaxSpeed, szWeapon, "CS_Item_GetMaxSpeed")
}
}
register_clcmd("say /noclip", "ClientCommand_NoClip")
register_clcmd("say /nc", "ClientCommand_NoClip")
}
public Player_Spawn( id )
{
g_bNoClip[id ] = false
}
public CS_Item_GetMaxSpeed( iEnt )
{
if( g_bNoClip[ get_pdata_cbase(iEnt, m_pPlayer, 4) ] )
{
SetHamReturnFloat(get_pcvar_float(g_pCvarSpeed))
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public ClientCommand_NoClip( id )
{
new Float:flMaxSpeed
if( (g_bNoClip[ id ] = !g_bNoClip[ id ]) )
{
set_pev(id, pev_movetype, MOVETYPE_NOCLIP)
flMaxSpeed = get_pcvar_float(g_pCvarSpeed)
ChatColor(id,"^4[%s] ^3Falon Átjárás Bekapcsolva",PLUGIN_TAG)
#if defined USE_KZ_ARG
kz_cheat_detection(id, "NoClip")
#endif
}
else
{
new iWeapon = get_pdata_cbase(id, m_pActiveItem, 5)
if( iWeapon )
{
ExecuteHamB(Ham_CS_Item_GetMaxSpeed, iWeapon, flMaxSpeed)
}
else
{
flMaxSpeed = 250.0
}
set_pev(id, pev_movetype, MOVETYPE_WALK)
ChatColor(id,"^4[%s] ^3Falon Átjárás Kikapcsolva",PLUGIN_TAG)
}
engfunc(EngFunc_SetClientMaxspeed, id, flMaxSpeed)
set_pev(id, pev_maxspeed, flMaxSpeed)
return PLUGIN_HANDLED
}
stock ChatColor(const id, const szMessage[], any:...)
{
static pnum, players[32], szMsg[190], IdMsg;
vformat(szMsg, charsmax(szMsg), szMessage, 3);
if(!IdMsg) IdMsg = get_user_msgid("SayText");
if(id)
{
if(!is_user_connected(id)) return;
players[0] = id;
pnum = 1;
}
else get_players(players, pnum, "ch");
for(new i; i < pnum; i++)
{
message_begin(MSG_ONE, IdMsg, .player = players[i]);
write_byte(players[i]);
write_string(szMsg);
message_end();
}
}