Update: i found a plugin that could do all what am asking for, but has some errors and i would really love if someone could help me fixing these:
1) the freeze doesnt come on first round
2) the freeze last forever (doesnt unfreeze)
3) i want it to freeze ALL first zombies (like if there are 3 first zombies, then they all should be frozen not only one)
here is the code:
Code:
#include < amxmodx >
#include < fun >
#include < fakemeta >
#include < hamsandwich >
#include < zp50_core >
#include < zp50_colorchat >
#define _PLUGIN "[ZP50] Addon: Escape Servers"
#define _VERSION "1.0"
#define _AUTHOR "H.RED.ZONE"
// Bits.
#define flag_get(%1,%2) ( %1 & (1 << (%2 & 31)))
#define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
#define flag_set(%1,%2) ( %1 |= (1 << (%2 & 31)))
#define flag_unset(%1,%2) ( %1 &= ~(1 << (%2 & 31)))
// Task.
#define TASK_FROZEN 1444
// Bit.
new _bitPlayerBlocked
// Cvars.
new _pCvarTimeFrozen
// Call When Map Loads.
public plugin_init( ) {
// Register Plugin.
register_plugin( _PLUGIN, _VERSION, _AUTHOR)
// Register Ham.
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "FW__KnifeAttack" )
RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "FW__KnifeAttack" )
// Register Cvar.
_pCvarTimeFrozen = register_cvar( "zp_escape_freeze", "5.0" )
}
// Call When Player is Infected.
public zp_fw_core_infect( id, attacker ) {
// If User is First Zombie.
if( zp_core_is_first_zombie(id) ) {
// If Pev Not Valid Return.
if( !pev_valid(id) )
return
// Print Message.
zp_colored_print( id, "You are frozen." )
// Mark Him As Blocked.
flag_set( _bitPlayerBlocked, id )
// Set User Frozen.
set_pev( id, pev_flags, pev( id, pev_flags) | FL_FROZEN )
// Set User God Mode.
set_user_godmode( id, true )
// Set task.
set_task( get_pcvar_float(_pCvarTimeFrozen), "RemoveFreeze", id + TASK_FROZEN)
}
}
// Are Task.
public RemoveFreeze( id ) {
// If Pev Not Valid Return.
if( !pev_valid(id) )
return
// Remove Frost.
set_pev( id, pev_flags, pev( id, pev_flags ) & ~FL_FROZEN );
// Print Message.
zp_colored_print( id, "Infect humans now." )
// Clear Player As Blocked.
flag_unset( _bitPlayerBlocked, id )
// Remove God Mode.
set_user_godmode( id, false )
}
// For Blocking Attack.
public FW__KnifeAttack( Ent ) {
// Get Owner.
new id = pev( Ent, pev_owner )
// Return So he Can't Attack.
if( flag_get(_bitPlayerBlocked, id) )
return HAM_SUPERCEDE
// Ham Ignored.
return HAM_IGNORED
}
// If Client Disconnects.
public client_disconnect( id ) {
// Remove Task.
remove_task(TASK_FROZEN)
// UnMark Him.
flag_unset( _bitPlayerBlocked, id )
}
__________________