AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   switch to ZP mode (https://forums.alliedmods.net/showthread.php?t=331971)

Itz 04-16-2021 08:18

switch to ZP mode
 
Wanted to switch this mode to a zombie plague 5.0 gamemode

PHP Code:

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

// Comment/Uncomment that if you want to auto un-freeze players after an ammount of time
//#define FROZENTIMELIMIT

#define MAXPLAYERS 32

// Task IDs
#define TASKID_ROUNDEND 1338
#define TASKID_UNFREEZE 8331

// Player Team
new CsTeams:g_TeamMAXPLAYERS ]

#if defined FROZENTIMELIMIT
    // Time count
    
new g_TimeMAXPLAYERS ]
#endif

// Frozen/Alive T count
new g_FrozenTg_aliveT

// HudSync / HideWeapon msg / SayText msg
new g_HudSyncg_msgHideWeapong_msgSayText

// CVAR
new cvar_roundtimecvar_hidecrosshair
#if defined FROZENTIMELIMIT
    
cvar_maxfrozentimecCvar_maxfrozentime
#endif

// Remove objetives
new PrecacheSpawn
new const RemoveEntities[ ][ ] =
{
    
"func_hostage_rescue""info_hostage_rescue""func_bomb_target""info_bomb_target",
    
"hostage_entity""info_vip_start""func_vip_safetyzone""func_escapezone"
}

// mp_roundtime pointer
new p_roundtime

new g_maxplayers

public plugin_init( )
{
    
// Remove objetives
    
unregister_forwardFM_SpawnPrecacheSpawn )
    
    
register_plugin"Freeze Tag""1.4""Javivi" )
    
    
// Hamsandwich forwards
    
RegisterHamHam_Spawn"player""fw_PlayerSpawn")
    
RegisterHamHam_Killed"player""fw_PlayerKilled")    
    
RegisterHamHam_Touch"player""fw_PlayerTouch" )
    
    
// Info
    
register_clcmd"say /status""status" )
        
    
// Block buy
    
register_messageget_user_msgid"StatusIcon" ), "msg_statusicon" )
    
    
// Block win sound & win msg
    
register_messageget_user_msgid"SendAudio" ), "msg_sendaudio" )
    
register_messageget_user_msgid"TextMsg" ), "msg_textmsg" )
    
    
// Round start
    
register_event"HLTV""new_round""a""1=0""2=0" );
    
    
// CVARs
    
cvar_roundtime register_cvar"ft_roundtime""180.0" )
    
cvar_hidecrosshair register_cvar"ft_hidecrosshair""1" )
    
    
#if defined FROZENTIMELIMIT
        
cvar_maxfrozentime register_cvar"ft_maxfrozentime""120" )
    
#endif
    
    // Hide weapon msg
    
g_msgHideWeapon get_user_msgid"HideWeapon" )
    
    
// SayText msg
    
g_msgSayText get_user_msgid"SayText" )
        
    
// Remove all weapons on the map
    
new Ent = -1
    
while ( ( Ent find_ent_by_classEnt"armoury_entity" ) ) ) 
    { 
        
remove_entityEnt )
    }
    
    
// Gamemonitor info
    
register_cvar"ft_version""1.4 by Javivi"FCVAR_SERVER|FCVAR_SPONLY )
    
    
// Roundtime pointer
    
p_roundtime get_cvar_pointer"mp_roundtime" )
    
    
// Set no freezetime
    
set_cvar_num"mp_freezetime")
    
    
g_maxplayers get_maxplayers( )
    
    
g_HudSync CreateHudSyncObj( )
}

public 
statusid )
{
    
client_printidprint_chat"Alive: %d  Frozen: %d"g_aliveTg_FrozenT )
}

// Remove objetives
public plugin_precache( )
    
PrecacheSpawn register_forwardFM_Spawn"precache_spawn")

public 
precache_spawnent )
{
    if( 
is_valid_entent ) )
    {
        static 
szClass33 ]
        
entity_get_stringentEV_SZ_classnameszClasssizeofszClass ) )
        for( new 
0sizeofRemoveEntities ); i++ )
            if( 
equalszClassRemoveEntities]) )
                
remove_entityent )
    }
}

public 
client_disconnectid )
{
    if( 
g_Teamid ] == CS_TEAM_T && is_user_aliveid ) )
    {
        
g_aliveT--
        
        
// Check if all the terrorist are frozen
        
CheckTerrorist( )
    }
}

public 
fw_PlayerSpawnid )
{
    if( 
is_user_aliveid ) )
    {            
        
set_user_renderingid )
        
strip_user_weaponsid )
        
        if( 
get_pcvar_numcvar_hidecrosshair ) )
        {
            
message_beginMSG_ONEg_msgHideWeapon_id )
            
write_byte1<<)
            
message_end( )
        }
        
        
g_Teamid ] = cs_get_user_teamid )
        
        if( 
g_Teamid ] == CS_TEAM_T )
            
g_aliveT++
    }
}

public 
fw_PlayerKilledvictim )
{
    if( 
g_Teamvictim ] == CS_TEAM_T )
    {
        
g_aliveT--
        
        
// Check if all the terrorist are frozen
        
CheckTerrorist( )
    }
}

public 
fw_PlayerTouchTouchedToucher )
{
    if( ( 
<= Toucher <= g_maxplayers ) )
    {
        static 
FlagsFlags entity_get_intTouchedEV_INT_flags )
            
        
// Freeze an enemy
        
if( g_TeamToucher ] == CS_TEAM_CT && g_TeamTouched ] == CS_TEAM_T )
        {
            
// Already frozen ?
            
if( Flags FL_FROZEN )
                return
                
            
entity_set_intTouchedEV_INT_flagsFlags FL_FROZEN )
            
            
g_FrozenT++
            
            
// msg        
            
static dName33 ]; get_user_nameToucheddNamecharsmaxdName ) )
            static 
rName33 ]; get_user_nameToucherrNamecharsmaxrName ) )
            
            new 
chatcolor125 ]
            
formatexchatcolor124"^3[ Freeze Tag ]^4 %s ^1has been tagged by^4 %s ^1, and is now frozen!"dNamerName
            
client_print_cchatcolor )

            
// Check if all the terrorist are frozen
            
CheckTerrorist( )
            
            
set_user_renderingTouchedkRenderFxGlowShell25500kRenderNormal40 )
            
            
#if defined FROZENTIMELIMIT
                
g_TimeTouched ] = 0
                set_task
1.0"CountDown"Touched TASKID_UNFREEZE__"b" )
            
#endif
        
}
        
        
// Unfreeze a teammate
        
if( g_TeamToucher ] == CS_TEAM_T && g_TeamTouched ] == CS_TEAM_T )
        {
            if( 
Flags FL_FROZEN )
            {
                
#if defined FROZENTIMELIMIT
                    
remove_taskTouched TASKID_UNFREEZE )
                
#endif
                
                // msg        
                
static dName33 ]; get_user_nameToucheddNamecharsmaxdName ) )
                static 
rName33 ]; get_user_nameToucherrNamecharsmaxrName ) )
        
                new 
chatcolor125 ]
                
formatexchatcolor124"^3[ Freeze Tag ]^4 %s ^1has been untagged by^4 %s ^1, and is now unfrozen!"dNamerName
                
client_print_cchatcolor )
                
                
entity_set_intTouchedEV_INT_flagsFlags &~ FL_FROZEN )
                
                
g_FrozenT--
                
                
set_user_renderingTouched )
            }
        }
    }
}

// Round Start
public new_round( )
{
    
g_FrozenT 0
    g_aliveT 
0
    
    
#if defined FROZENTIMELIMIT
        // Cache the maxfrozentime cvar
        
cCvar_maxfrozentime get_pcvar_numcvar_maxfrozentime )
    
#endif
    
    
static Float:ccvar_roundtimeccvar_roundtime get_pcvar_floatcvar_roundtime )
    
    
set_pcvar_floatp_roundtimeccvar_roundtime 60 )
    
    
// mmm
    
remove_taskTASKID_ROUNDEND )
    
    
set_taskccvar_roundtime"Roundend"TASKID_ROUNDEND )
}

public 
Roundendtask )
{
    
set_hudmessage25500, -1.00.4016.05.0 )
    
ShowSyncHudMsg0g_HudSync"Terrorist Win !" )
    
client_cmd0"spk radio/terwin.wav" )
    
    
g_aliveT 0
    
    
for ( new id 1id <= g_maxplayersid++ )
    {
        if( !
is_user_connectedid ) )
            continue
            
        
Unfreezeid )
        
        switch( 
g_Team id ] )
        {
            case 
CS_TEAM_CTuser_silentkillid )
            case 
CS_TEAM_Tset_user_fragsidget_user_fragsid ) + )
        }
    }
}

#if defined FROZENTIMELIMIT
public CountDowntask )
{
    static 
idid task TASKID_UNFREEZE
    
    g_Time
id ]++
    
    if( 
g_Timeid ] >= cCvar_maxfrozentime )
    {
        
Unfreezeid )
        
        
remove_tasktask )
        
        return
    }

    
set_hudmessage255255255, -1.0, -1.006.01.0 )
    
ShowSyncHudMsg0g_HudSync"You will be auto un-frozen in : %d"cCvar_maxfrozentime g_Timeid ] )
}
#endif

public Unfreezeid )
{
    
// Unfreeze player if it's frozen
    
static FlagsFlags entity_get_intidEV_INT_flags )
    if( 
Flags FL_FROZEN )
        
entity_set_intidEV_INT_flagsFlags &~ FL_FROZEN )
}

// Buyzone
public msg_statusiconmsgiddestid )
{
    static 
icon]
    
get_msg_arg_string2iconcharsmaxicon ) )
    
    if( 
icon] == 'b' && icon] == 'y' && icon] == 'z' )
    {
        
// Block buy
        
set_pdata_intid235get_pdata_intid235 ) &~ ( 1<<) )
        return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
}

// Block win msg
public msg_textmsgmsg_idmsg_destmsg_entity )
{
    static 
message]
    
get_msg_arg_string2messagecharsmaxmessage ) )

    switch( 
message[1] )
    {
        case 
'C''T'
            return 
PLUGIN_HANDLED
    
}
        
    return 
PLUGIN_CONTINUE
}

// Block win sound
public msg_sendaudiomsg_idmsg_destmsg_entity )
{
    static 
message[10]
    
get_msg_arg_string2messagecharsmaxmessage ) )

    switch( 
message[7] )
    {
        case 
'c''t' 
            return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE
}

// Check if all the terrorist are frozen
CheckTerrorist( )
{
    if( 
g_aliveT == g_FrozenT )
    {
        
remove_taskTASKID_ROUNDEND )
        
g_aliveT 0
        
        set_hudmessage
00255, -1.00.4016.05.0 )
        
ShowSyncHudMsg0g_HudSync"Counter-Terrorist Win !" )
        
client_cmd0"spk radio/ctwin.wav" )
        
        
// Swap teams
        
for ( new id 1id <= g_maxplayersid++ )
        {
            if( !
is_user_connectedid ) )
                continue
                
            
Unfreezeid )
            
            switch( 
g_Teamid ] )
            {
                case 
CS_TEAM_T
                {
                    
user_silentkillid )
                    
cs_set_user_teamid CS_TEAM_CT )
                }
                case 
CS_TEAM_CT
                {
                    
set_user_fragsidget_user_fragsid ) + )
                    
cs_set_user_teamidCS_TEAM_T )
                }
            }
        }
    }
}

// Chat color stock
client_print_c(const fmt[], any:...) 

    new 
szString[128
    
szString[0] = 

    vformat
(szStringsizeofszString ) - 2fmt2

    
message_begin(MSG_BROADCASTg_msgSayText
    
write_byte(1
    
write_string(szString
    
message_end() 




All times are GMT -4. The time now is 19:52.

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