Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

7 страниц V   1 2 ... 5 6 »

Ограничить покупку модов ( Zombie Plague Advanced )

, Во времени ( ночное ) / через 1 раунд / через 1 карту
Статус пользователя Slackerok
сообщение 25.3.2013, 21:13
Сообщение #1
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Всем привет! Парни помогите реализовать эти ограничения. На сервере есть плагины которые позволяют покупать моды за аммо паки: Survivor, Nemesis, Sniper, Assassin. Хотелось бы эти плагины немножко ограничить. Идеи таковы:

По поводу ночного времени:

Запретить с 22.00 по 10.00 покупать моды Survivor, Sniper, Assassin кроме Nemesis. То есть при попытке покупке любого мода в запрещенное время в чате клиента:

[ZP] This mod allowed to buy only from 10.00 to 22.00.

По поводу через 1 раунда:

Разрешать покупать моды только если перед этим был чистый ( Infection ) раунд. То есть если перед покупки был один из раундов Multi Infection, Swarm, Plague, Armageddon, Nightmare, Assassin vs Sniper а также Assassin Mod, Sniper Mod, Nemesis Mod, Survivor Mod то покупка не разрешается и в чате клиента пишет:

[ZP] You can buy mods after this round. // Если конечно же этот раунд будет простой ( Infection )

По поводу через 1 карту:

Хотелось бы ограничить генерально покупку модов для каждого клиента отдельно ( проверку по IP сделать ). То есть допустим клиент Ivan сделал себе на карту zm_dust2 170 аммо паков на мод Sniper и купил его. Плагин регистрирует его, запоминает и больше не дает ему возможность купить моды. На следующей карте сервер также не даст ему купить еще моды а напишет:

[ZP] You can buy mods after this map. // И Только после следующей карты клиент получит возможность купить снова один из 4 выше перечисленных модов.

Вот все плагины:
zp_buy_nemesis
Код
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Nemesis"
#define VERSION "0.1.1"
#define AUTHOR "fezh"

new g_nemesis
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_nemesis_buy", "1" )
    pcvar_cost = register_cvar( "zp_nemesis_cost", "150" )
    pcvar_hudtime = register_cvar( "zp_nemesis_hudtime", "2.0" )
    
    g_nemesis = zp_register_extra_item( "Nemesis", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )

    register_cvar( "zp_extra_nemesis", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_nemesis )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must to buy Nemesis before the round start!" )
            return ZP_PLUGIN_HANDLED
        }

        zp_make_user_nemesis( id )

        colored_print( id, "^x04[ZP]^x01 You became Nemesis!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "nemesis_message", id )
    }
    return PLUGIN_HANDLED
}

public nemesis_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s buy Nemesis!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}
zp_buy_sniper
Код
#include <amxmodx>
#include <zombieplaguenew1.3>

#define PLUGIN "[ZP] Extra Item: Become Sniper"
#define VERSION "0.0.1"
#define AUTHOR "none"

new g_sniper
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_sniper_buy", "1" )
    pcvar_cost = register_cvar( "zp_sniper_cost", "170" )
    pcvar_hudtime = register_cvar( "zp_sniper_hudtime", "2.0" )
    
    g_sniper = zp_register_extra_item( "Sniper", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )

    register_cvar( "zp_extra_sniper", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_sniper )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must buy a Sniper before the round start!" )
            return ZP_PLUGIN_HANDLED
        }

        zp_make_user_sniper( id )

        colored_print( id, "^x04[ZP]^x01 became a Sniper!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "sniper_message", id )
    }
    return PLUGIN_HANDLED
}

public sniper_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s buy Sniper!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}
zp_buy_survivor
Код
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Survivor"
#define VERSION "0.1"
#define AUTHOR "aOx"

new g_buysurv
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_surv_buy", "1" )
    pcvar_cost = register_cvar( "zp_surv_cost", "140" )
    pcvar_hudtime = register_cvar( "zp_surv_hudtime", "2.0" )
    
    g_buysurv = zp_register_extra_item( "Survivor", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )
    
    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )
    
    register_cvar( "zp_extra_survivor", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_buysurv )
    {
        if( zp_has_round_started() )
    {
        colored_print( id, "^x04[ZP]^x01 You must buy a Survivor before the round start!" )
        return ZP_PLUGIN_HANDLED
    }

        zp_make_user_survivor( id )
        colored_print( id, "^x04[ZP]^x01 became a Survivor!" )
        set_task( get_pcvar_float( pcvar_hudtime ), "survivor_message", id )
    }
    return PLUGIN_HANDLED
}

public survivor_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s became a Survivor!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}

        
    
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1251\\ deff0\\ deflang1049{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
zp_buy_assassin
Код
#include <amxmodx>
#include <zombieplaguenew1.3>

#define PLUGIN "[ZP] Extra Item: Become Assassin"
#define VERSION "0.0.1"
#define AUTHOR "none"

new g_assassin
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_assassin_buy", "1" )
    pcvar_cost = register_cvar( "zp_assassin_cost", "160" )
    pcvar_hudtime = register_cvar( "zp_assassin_hudtime", "2.0" )
    
    g_assassin = zp_register_extra_item( "Assassin", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )

    register_cvar( "zp_extra_assassin", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_assassin )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must buy an Assassin before the round start!" )
            return ZP_PLUGIN_HANDLED
        }

        zp_make_user_assassin( id )

        colored_print( id, "^x04[ZP]^x01 became an Assassin!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "assassin_message", id )
    }
    return PLUGIN_HANDLED
}

public assassin_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s became an Assassin!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}
mod_assassins_vs_snipers
Код
#include < amxmodx >
#include < fun >
#include < zombie_plague_advance >

/************************************************************\
|                  Customizations Section                    |
|         You can edit here according to your liking         |
\************************************************************/

// This is the chance value according to which this game mode will be called
// The higher the value the lesser the chance of calling this game mode
new const g_chance = 30

// This is the access flag required to start the game mode
// through the admin menu. Look in users.ini for more details
new const g_access_flag[] = "r"

// This is the sound which is played when the game mode is triggered
// Add as many as you want [Randomly chosen if more than one]
new const g_play_sounds[][] =
{
    "zombie_plague/armaged_2012_1.wav"
}

// Comment the following line to disable ambience sounds
// Just add two slashes ( // )
#define AMBIENCE_SOUNDS

#if defined AMBIENCE_SOUNDS
// Ambience Sounds (only .wav and .mp3 formats supported)
// Add as many as you want [Randomly chosen if more than one]
new const g_sound_ambience[][] =
{
    "zombie_plague/aq13_official_soundtrack.wav"
}

// Duration in seconds of each sound
new const Float:g_sound_ambience_duration[] = { 28.0 , 267.0 }
#endif

/************************************************************\
|                  Customizations Ends Here..!!              |
|         You can edit the cvars in the plugin init          |
\************************************************************/

// Variables
new g_gameid, g_maxplayers, cvar_minplayers, cvar_ratio, cvar_sniperhp, cvar_assahp, g_msg_sync

// Ambience sounds task
#define TASK_AMB 3256

public plugin_init( )
{
    // Plugin registeration.
    register_plugin( "[ZP] Assassin vs Snipers Mode","1.0", "@bdul!" )
    
    // Register some cvars
    // Edit these according to your liking
    cvar_minplayers = register_cvar("zp_avsm_minplayers", "16")
    cvar_sniperhp =      register_cvar("zp_avsm_sniper_hp", "1")
    cvar_assahp =      register_cvar("zp_avsm_assassin_hp", "2")
    cvar_ratio =       register_cvar("zp_avsm_inf_ratio", "0.5")
    
    // Get maxplayers
    g_maxplayers = get_maxplayers( )
    
    // Hud stuff
    g_msg_sync = CreateHudSyncObj()
}

// Game modes MUST be registered in plugin precache ONLY
public plugin_precache( )
{
    // Read the access flag
    new access_flag = read_flags( g_access_flag )
    new i
    
    // Precache the play sounds
    for (i = 0; i < sizeof g_play_sounds; i++)
        precache_sound( g_play_sounds[i] )
    
    // Precache the ambience sounds
    #if defined AMBIENCE_SOUNDS
    new sound[100]
    for (i = 0; i < sizeof g_sound_ambience; i++)
    {
        if (equal(g_sound_ambience[i][strlen(g_sound_ambience[i])-4], ".mp3"))
        {
            formatex(sound, sizeof sound - 1, "sound/%s", g_sound_ambience[i])
            precache_generic( sound )
        }
        else
        {
            precache_sound( g_sound_ambience[i] )
        }
    }
    #endif
    
    // Register our game mode
    g_gameid = zp_register_game_mode( "Assassin vs Snipers Mode", access_flag, g_chance, 0, ZP_DM_BALANCE )
}

// Player spawn post
public zp_player_spawn_post( id )
{
    // Check for current mode
    if( zp_get_current_mode() == g_gameid )
    {
        // Check if the player is a zombie
        if( zp_get_user_zombie( id ))
        {
            // Make him an assassin instead
            zp_make_user_sniper( id )
            
            // Set his health
            set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
        }
        else
        {
            // Make him a sniper
            zp_make_user_sniper( id )
            
            // Set his health
            set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
        }
    }
}

public zp_round_started_pre( game )
{
    // Check if it is our game mode
    if( game == g_gameid )
    {
        // Check for min players
        if( fn_get_alive_players() < get_pcvar_num(cvar_minplayers) )
        {
            /**
             * Note:
             * This very necessary, you should return ZP_PLUGIN_HANDLED if
             * some conditions required by your game mode are not met
             * This will inform the main plugin that you have rejected
             * the offer and so the main plugin will allow other game modes
             * to be given a chance
             */
            return ZP_PLUGIN_HANDLED
        }
        // Start our new mode
        start_avs_mode( )
    }
    // Make the compiler happy =)
    return PLUGIN_CONTINUE
}

public zp_round_started( game, id )
{
    // Check if it is our game mode
    if( game == g_gameid )
    {
        // Show HUD notice
        set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
        ShowSyncHudMsg(0, g_msg_sync, "Assassins vs Snipers Mode !!!")
        
        // Play the starting sound
        client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
        
        // Remove ambience task affects
        remove_task( TASK_AMB )
        
        // Set task to start ambience sounds
        #if defined AMBIENCE_SOUNDS
        set_task( 2.0, "start_ambience_sounds", TASK_AMB )
        #endif
    }
}

public zp_game_mode_selected( gameid, id )
{
    // Check if our game mode was called
    if( gameid == g_gameid )
        start_avs_mode( )
    
    // Make the compiler happy again =)
    return PLUGIN_CONTINUE
}

// This function contains the whole code behind this game mode
start_avs_mode( )
{
    // Create and initialize some important vars
    static i_assassins, i_max_assassins, id, i_alive
    i_alive = fn_get_alive_players()
    id = 0
    
    // Get the no of players we have to turn into assassins
    i_max_assassins = floatround( ( i_alive * get_pcvar_float( cvar_ratio ) ), floatround_ceil )
    i_assassins = 0
    
    // Randomly turn players into Assassins
    while (i_assassins < i_max_assassins)
    {
        // Keep looping through all players
        if ( (++id) > g_maxplayers) id = 1
        
        // Dead
        if ( !is_user_alive(id) )
            continue;
        
        // Random chance
        if (random_num(1, 5) == 1)
        {
            // Make user assassin
            zp_make_user_assassin(id)
            
            // Set his health
            set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_assahp)) )
            
            // Increase counter
            i_assassins++
        }
    }
    
    // Turn the remaining players into snipers
    for (id = 1; id <= g_maxplayers; id++)
    {
        // Only those of them who are alive and are not assassins
        if ( !is_user_alive(id) || zp_get_user_assassin(id) )
            continue;
            
        // Turn into a sniper
        zp_make_user_sniper(id)
        
        // Set his health
        set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_sniperhp)) )
    }
}

#if defined AMBIENCE_SOUNDS
public start_ambience_sounds( )
{
    // Variables
    static amb_sound[64], sound, Float:duration
    
    // Select our ambience sound
    sound = random_num( 0, sizeof g_sound_ambience - 1 )
    copy( amb_sound, sizeof amb_sound - 1 , g_sound_ambience[ sound ] )
    duration = g_sound_ambience_duration[ sound ]
    
    // Check whether it's a wav or mp3, then play it on clients
    if ( equal( amb_sound[ strlen( amb_sound ) - 4 ], ".mp3" ) )
        client_cmd( 0, "mp3 play ^"sound/%s^"", amb_sound )
    else
        client_cmd( 0, "spk ^"%s^"", sound )
    
    // Start the ambience sounds
    set_task( duration, "start_ambience_sounds", TASK_AMB )
}
public zp_round_ended( winteam )
{
    // Stop ambience sounds on round end
    remove_task( TASK_AMB )
}
#endif

// This function returns the no. of alive players
// Feel free to use this in your plugin when you
// are making your own game modes.
fn_get_alive_players( )
{
    static i_alive, id
    i_alive = 0
    
    for ( id = 1; id <= g_maxplayers; id++ )
    {
        if( is_user_alive( id ) )
            i_alive++
    }
    return i_alive;
}
mod_nightmare
Код
#include < amxmodx >
#include < fun >
#include < zombie_plague_advance >

/************************************************************\
|                  Customizations Section                    |
|         You can edit here according to your liking         |
\************************************************************/

// This is the chance value according to which this game mode will be called
// The higher the value the lesser the chance of calling this game mode
new const g_chance = 25

// This is the access flag required to start the game mode
// through the admin menu. Look in users.ini for more details
new const g_access_flag[] = "r"

// This is the sound which is played when the game mode is triggered
// Add as many as you want [Randomly chosen if more than one]
new const g_play_sounds[][] =
{
    "zombie_plague/armaged_2012_1.wav"
}

// Comment the following line to disable ambience sounds
// Just add two slashes ( // )
#define AMBIENCE_SOUNDS

#if defined AMBIENCE_SOUNDS
// Ambience Sounds (only .wav and .mp3 formats supported)
// Add as many as you want [Randomly chosen if more than one]
new const g_sound_ambience[][] =
{
    "zombie_plague/aq13_official_soundtrack.wav"
}

// Duration in seconds of each sound
new const Float:g_sound_ambience_duration[] = { 28.0 , 267.0 }
#endif

/************************************************************\
|                  Customizations Ends Here..!!              |
|         You can edit the cvars in the plugin init          |
\************************************************************/

// Variables
new g_gameid, g_maxplayers, cvar_minplayers, g_msg_sync

// Ambience sounds task
#define TASK_AMB 3256

public plugin_init( )
{
    // Plugin registeration.
    register_plugin( "[ZP] New Game Mode","1.0", "@bdul!" )
    
    // Register some cvars
    // Edit these according to your liking
    cvar_minplayers = register_cvar("zp_avsm_minplayers", "20")
    
    // Get maxplayers
    g_maxplayers = get_maxplayers( )
    
    // Hud stuff
    g_msg_sync = CreateHudSyncObj()
}

// Game modes MUST be registered in plugin precache ONLY
public plugin_precache( )
{
    // Read the access flag
    new access_flag = read_flags( g_access_flag )
    new i
    
    // Precache the play sounds
    for (i = 0; i < sizeof g_play_sounds; i++)
        precache_sound( g_play_sounds[i] )
    
    // Precache the ambience sounds
    #if defined AMBIENCE_SOUNDS
    new sound[100]
    for (i = 0; i < sizeof g_sound_ambience; i++)
    {
        if (equal(g_sound_ambience[i][strlen(g_sound_ambience[i])-4], ".mp3"))
        {
            formatex(sound, sizeof sound - 1, "sound/%s", g_sound_ambience[i])
            precache_generic( sound )
        }
        else
        {
            precache_sound( g_sound_ambience[i] )
        }
    }
    #endif
    
    // Register our game mode
    g_gameid = zp_register_game_mode( "Night-Mare Mode", access_flag, g_chance, 0, ZP_DM_BALANCE )
}

// Player spawn post
public zp_player_spawn_post( id, should_be_zombie )
{
    // Check for current mode
    if( zp_get_current_mode() == g_gameid )
    {
        // Check if the player was to be made a zombie
        if(should_be_zombie == 1 )
        {
            if( zp_get_assassin_count() > zp_get_nemesis_count() )
                zp_make_user_nemesis( id ) // make him an assassin instead
            else
                zp_make_user_assassin( id )
        }
        else
        {
            if( zp_get_sniper_count() > zp_get_survivor_count() )
                zp_make_user_survivor( id )
            else
                zp_make_user_sniper( id )
        }
        
        /**
        * Note:
        * This very necessary, you should return ZP_PLUGIN_HANDLED, if
        * you have used this forward and/or have performed an action
        * while using it, so that the main plugin will be informed about
        * this forward's usage.
        */
        return ZP_PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

public zp_round_started_pre( game )
{
    // Check if it is our game mode
    if( game == g_gameid )
    {
        // Check for min players
        if( fn_get_alive_players() < get_pcvar_num(cvar_minplayers) )
        {
            /**
            * Note:
            * This very necessary, you should return ZP_PLUGIN_HANDLED if
            * some conditions required by your game mode are not met
            * This will inform the main plugin that you have rejected
            * the offer and so the main plugin will allow other game modes
            * to be given a chance
            */
            return ZP_PLUGIN_HANDLED
        }
        // Start our new mode
        start_avs_mode( )
    }
    // Make the compiler happy =)
    return PLUGIN_CONTINUE
}

public zp_round_started( game, id )
{
    // Check if it is our game mode
    if( game == g_gameid )
    {
        // Show HUD notice
        set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
        ShowSyncHudMsg(0, g_msg_sync, "Night-Mare Mode !!!")
        
        // Play the starting sound
        client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
        
        // Remove ambience task affects
        remove_task( TASK_AMB )
        
        // Set task to start ambience sounds
        #if defined AMBIENCE_SOUNDS
        set_task( 2.0, "start_ambience_sounds", TASK_AMB )
        #endif
    }
}

public zp_game_mode_selected( gameid, id )
{
    // Check if our game mode was called
    if( gameid == g_gameid )
        start_avs_mode( )
    
    // Make the compiler happy again =)
    return PLUGIN_CONTINUE
}

// This function contains the whole code behind this game mode
start_avs_mode( )
{
    // Create and initialize some important vars
    static i_assassins, i_max_assassins, id, i_alive
    i_alive = fn_get_alive_players()
    id = 0
    
    // Get the no of players we have to turn into assassins
    i_max_assassins = floatround( ( i_alive * 0.25), floatround_ceil )
    i_assassins = 0
    
    // Randomly turn players into Assassins
    while (i_assassins < i_max_assassins)
    {
        // Keep looping through all players
        if ( (++id) > g_maxplayers) id = 1
        
        // Dead
        if ( !is_user_alive(id) )
            continue;
        
        // Random chance
        if (random_num(1, 5) == 1)
        {
            // Make user assassin
            zp_make_user_assassin(id)
            
            // Increase counter
            i_assassins++
        }
    }
    
    i_assassins = 0
    
    // Randomly turn players into Assassins
    while (i_assassins < i_max_assassins)
    {
        // Keep looping through all players
        if ( (++id) > g_maxplayers) id = 1
        
        // Dead
        if ( !is_user_alive(id) || zp_get_user_assassin(id))
            continue;
        
        // Random chance
        if (random_num(1, 5) == 1)
        {
            // Make user assassin
            zp_make_user_nemesis(id)
            
            // Increase counter
            i_assassins++
        }
    }
    
    i_assassins = 0
    
    // Randomly turn players into Assassins
    while (i_assassins < i_max_assassins)
    {
        // Keep looping through all players
        if ( (++id) > g_maxplayers) id = 1
        
        // Dead
        if ( !is_user_alive(id) || zp_get_user_assassin(id) || zp_get_user_nemesis(id) )
            continue;
        
        // Random chance
        if (random_num(1, 5) == 1)
        {
            // Make user assassin
            zp_make_user_survivor(id)
            
            // Increase counter
            i_assassins++
        }
    }
    
    // Turn the remaining players into snipers
    for (id = 1; id <= g_maxplayers; id++)
    {
        // Only those of them who are alive and are not assassins
        if ( !is_user_alive(id) || zp_get_user_assassin(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id) )
            continue;
        
        // Turn into a sniper
        zp_make_user_sniper(id)
    }
}

#if defined AMBIENCE_SOUNDS
public start_ambience_sounds( )
{
    // Variables
    static amb_sound[64], sound, Float:duration
    
    // Select our ambience sound
    sound = random_num( 0, sizeof g_sound_ambience - 1 )
    copy( amb_sound, sizeof amb_sound - 1 , g_sound_ambience[ sound ] )
    duration = g_sound_ambience_duration[ sound ]
    
    // Check whether it's a wav or mp3, then play it on clients
    if ( equal( amb_sound[ strlen( amb_sound ) - 4 ], ".mp3" ) )
        client_cmd( 0, "mp3 play ^"sound/%s^"", amb_sound )
    else
        client_cmd( 0, "spk ^"%s^"", sound )
    
    // Start the ambience sounds
    set_task( duration, "start_ambience_sounds", TASK_AMB )
}
public zp_round_ended( winteam )
{
    // Stop ambience sounds on round end
    remove_task( TASK_AMB )
}
#endif

// This function returns the no. of alive players
// Feel free to use this in your plugin when you
// are making your own game modes.
fn_get_alive_players( )
{
    static i_alive, id
    i_alive = 0
    
    for ( id = 1; id <= g_maxplayers; id++ )
    {
        if( is_user_alive( id ) )
            i_alive++
    }
    return i_alive;
}


И на всякий случай исходник самого Zombie Plague Advance:
Прикрепленный файл  zombie_plague_advance_v1_6_1_backup.sma ( 419,6 килобайт ) Кол-во скачиваний: 68

Заранее спасибо и желаю Всем хорошего вечера! drinks.gif

Отредактировал: Slackerok, - 27.3.2013, 21:53
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 8:21
Сообщение #2


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

Мне не хочется в такой куче кода искать нужное место
https://c-s.net.ua/forum/topic50723.html тут написано как примерно сделать функция чтобы выполнялась только в определенные часы.


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 12:15
Сообщение #3
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

mazdan, хорошо) Я попробую сделать из того что понимать буду из вашей функции:

Пример для первого из списка плагина zp_buy_nemesis:

Скрытый текст
Код
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Nemesis"
#define VERSION "0.1.1"
#define AUTHOR "fezh"

new g_nemesis
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime
new Hours[3], HourWork[18] = {22, 23, 00, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_nemesis_buy", "1" )
    pcvar_cost = register_cvar( "zp_nemesis_cost", "150" )
    pcvar_hudtime = register_cvar( "zp_nemesis_hudtime", "2.0" )
    
    g_nemesis = zp_register_extra_item( "Nemesis", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )

    register_cvar( "zp_extra_nemesis", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public is_restrict_hour()
{
get_time("%H", Hours, sizeof(Hours)-1)
new hnum
new res
hnum = num_to_str(Hours)
for (new i; i<18;i++)
{
if(hnum == HourWork[i])
{
res = i+1
break
}
}
return res
}
if(is_restrict_hour()) make_player_happy()

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_nemesis )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must to buy Nemesis before the round start!" )
            return ZP_PLUGIN_HANDLED
        }

        zp_make_user_nemesis( id )

        colored_print( id, "^x04[ZP]^x01 You became Nemesis!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "nemesis_message", id )
    }
    return PLUGIN_HANDLED
}

public nemesis_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s buy Nemesis!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}
Я знаю что это не так =) Но мои знания в скриптинге почти нулевые....

new Hours[3], HourWork[18] = {22, 23, 00, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} // это время с 22 часов до 12 ?

Код
if(is_restrict_hour()) make_player_happy()


здесь по моему надо тоже изменить чтобы позволить плагину дальше работать

Отредактировал: Slackerok, - 31.3.2013, 12:50
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 12:32
Сообщение #4


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

18 заменить надо на 15 или сколько у вас там цифр будет.
if(is_restrict_hour()) make_player_happy() убрать
перед zp_make_user_nemesis( id )
добавить
Код
        if( is_restrict_hour() )
        {
            colored_print( id, "^x04[ZP]^x01 Вы не можете купить эту хрень до утра" )
            return ZP_PLUGIN_HANDLED
        }


Суму функцию можно сделать такой
Код
public is_restrict_hour()
{
    get_time("%H", Hours, sizeof(Hours)-1)
    new hnum
    hnum = num_to_str(Hours)
    return (hnum < 10 || hnum > 22)
}


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 12:38
Сообщение #5
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Все понял) уже сам отредактирую остальные плагины, спасибо drinks.gif

Код
return (hnum < 10 || hnum > 22)


Это и отвечает за время)

Отредактировал: Slackerok, - 31.3.2013, 12:44
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 12:45
Сообщение #6
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Теперь надо сделать чтобы моды запрещались покупать если перед этим был любой из модов кроме чистого Infection-раунда. Не подскажете как сделать проверку if_is_nemesis_round:

Код
if( перед этим раундом is_nemesis_round() )
        {
            colored_print( id, "^x04[ZP]^x01 Вы можете купить эту хрень после этого раунда!" )
            return ZP_PLUGIN_HANDLED
        }


Отредактировал: Slackerok, - 31.3.2013, 12:47
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 13:21
Сообщение #7


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

а как определить все раунды которые бывают?
Наподобие is_nemesis_round() есть ли is_infection_round() раунд?
Это вообще нужно 1 раз проверять в начале раунда - какой он, запоминать.
У вас там есть logevent_round_end
добавляете в него
Код
g_clean_infected = (zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_swarm_round() || zp_is_plague_round() || zp_is_sniper_round() || zp_is_assassin_round() || zp_is_lnj_round())?false:true
тут проверяем закончившийся раунд один из этих и если нет то разрешаем покупку. Я не знаю какой из них инфекшен или типо того, просто все нативы собрал

В начало вашего плагина new bool:g_clean_infected и вместо if( перед этим раундом is_nemesis_round() ) будет if( g_clean_infected)


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 14:20
Сообщение #8
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Как я понял нативы logevent_round_end надо добавить в базового исходника ZPA ?

вот кусок кода из базового плагина
Код
// Log Event Round End
public logevent_round_end()
{
    // Prevent this from getting called twice when restarting (bugfix)
    static Float:lastendtime, Float:current_time
    current_time = get_gametime()
    if (current_time - lastendtime < 0.5) return;
    lastendtime = current_time
    
    // Temporarily save player stats?
    if (get_pcvar_num(cvar_statssave))
    {
        static id, team
        for (id = 1; id <= g_maxplayers; id++)
        {
            // Not connected
            if (!g_isconnected[id])
                continue;
            
            team = fm_cs_get_user_team(id)
            
            // Not playing
            if (team == FM_CS_TEAM_SPECTATOR || team == FM_CS_TEAM_UNASSIGNED)
                continue;
            
            save_stats(id)
        }
    }


И в плагине покупки мода уже добавлять перед zp_make_user_nemesis( id ):

Код
new bool:g_clean_infected

........

if( g_clean_infected)

{
            colored_print( id, "^x04[ZP]^x01 Вы можете купить эту хрень после этого раунда!" )
            return ZP_PLUGIN_HANDLED
        }


Отредактировал: Slackerok, - 31.3.2013, 14:24
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 14:34
Сообщение #9


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

я наугад тыкнул
Вам в нескольких плагинах нужно одно и то же проверять получается? Тогда лучше сделать натив в основном плагине


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 14:44
Сообщение #10
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Да, в каждом из 4 плагинов покупок надо будет проверять на закончившийся раунд. Значит если сделать так как в предыдущем моем посте тогда все сработает?

И еще вопрос по этому поводу, Моды Nightmare и Assassins vs Snipers какой натив имеют? zp_is_avs_mod?

По поводу ночного времени идет эррор:
Скрин
Вот как сделал
Код
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Nemesis"
#define VERSION "0.1.1"
#define AUTHOR "fezh"

new g_nemesis
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime
new Hours[3], HourWork[13] = {22, 23, 00, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_nemesis_buy", "1" )
    pcvar_cost = register_cvar( "zp_nemesis_cost", "150" )
    pcvar_hudtime = register_cvar( "zp_nemesis_hudtime", "2.0" )
    
    g_nemesis = zp_register_extra_item( "Nemesis", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )

    register_cvar( "zp_extra_nemesis", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public is_restrict_hour()
{
    get_time("%H", Hours, sizeof(Hours)-1)
    new hnum
    hnum = num_to_str(Hours)
    return (hnum < 10 || hnum > 22)
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_nemesis )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must to buy Nemesis before the round start!" )
            return ZP_PLUGIN_HANDLED
        }

if( is_restrict_hour() )
        {
            colored_print( id, "^x04[ZP]^x01 This mod allowed to buy only from ^x0410.00^x01 to ^x0422.00^x01 !" )
            return ZP_PLUGIN_HANDLED
        }

        zp_make_user_nemesis( id )

        colored_print( id, "^x04[ZP]^x01 You became Nemesis!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "nemesis_message", id )
    }
    return PLUGIN_HANDLED
}

public nemesis_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s buy Nemesis!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}


Отредактировал: Slackerok, - 31.3.2013, 14:47
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 15:12
Сообщение #11


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

num_to_str надо на str_to_num поменять - я попутал там.


Тогда проще в вашем случае всё вынести в основной плагин (всё что наделали отменяем)
Добавляете в него в самый конец основного плагина

Код
public native_is_restricted()
{
if(!g_notcleanround) // прошлый раунд был чистый?
{
    static Hours[3]
    get_time("%H", Hours, 2)
    static hnum
    hnum = str_to_num(Hours)
    return (hnum < 10 || hnum > 22) // время подходит?
}
return 2
}

там где регистрация нативов добавляете
register_native("zp_is_restricted", "native_is_restricted", 1)

Там где объявляются переменные new g_notcleanround
Там где раунд заканчивается
g_notcleanround = (g_nemround || g_survround || g_swarmround || g_plagueround || g_sniperround ||g_assassinround || g_lnjround) //тут все переменные, по которым раунд считается не чистым, если какая-то 1 то g_notcleanround будет тоже 1

Соответственно в ваши плагины добавляете
Код
new restricted
restricted = zp_is_restricted()
if(restricted == 1 )
{
       colored_print( id, "^x04[ZP]^x01 This mod allowed to buy only from ^x0410.00^x01 to ^x0422.00^x01 !" )
            return ZP_PLUGIN_HANDLED
}
if(restricted == 2 )
{
       colored_print( id, "^x04[ZP]^x01 Прошлый раунд был не чистый!" )
            return ZP_PLUGIN_HANDLED
}


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 15:25
Сообщение #12
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Спасибо, сейчас попробую. Есть еще Nightmare Round и Assassins vs Snipers Round. Как их определить?

Плагин покупки выдает еррор:

Скрин
zp_buy_nemesis
Код
#include <amxmodx>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Nemesis"
#define VERSION "0.1.1"
#define AUTHOR "fezh"

new g_nemesis
new g_msgSayText
new g_maxplayers

new pcvar_enabled, pcvar_cost, pcvar_hudtime
new restricted

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    pcvar_enabled = register_cvar( "zp_nemesis_buy", "1" )
    pcvar_cost = register_cvar( "zp_nemesis_cost", "150" )
    pcvar_hudtime = register_cvar( "zp_nemesis_hudtime", "2.0" )
    
    g_nemesis = zp_register_extra_item( "Nemesis", get_pcvar_num( pcvar_cost ) , ZP_TEAM_HUMAN )

    g_maxplayers = get_maxplayers()
    g_msgSayText = get_user_msgid( "SayText" )
        
    register_cvar( "zp_extra_nemesis", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY )
}

public zp_extra_item_selected( id, item )
{
    if( !get_pcvar_num( pcvar_enabled ) )
        return PLUGIN_HANDLED
    
    if( item == g_nemesis )
    {
        if( zp_has_round_started() )
        {
            colored_print( id, "^x04[ZP]^x01 You must to buy Nemesis before the round start!" )
            return ZP_PLUGIN_HANDLED
        }
restricted = zp_is_restricted()
if(restricted == 1 )
{
       colored_print( id, "^x04[ZP]^x01 This mod allowed to buy only from ^x0410.00^x01 to ^x0422.00^x01 !" )
            return ZP_PLUGIN_HANDLED
}
if(restricted == 2 )
{
       colored_print( id, "^x04[ZP]^x01 You can buy this mod after clean ( No Mod ) Round!" )
            return ZP_PLUGIN_HANDLED
}
        zp_make_user_nemesis( id )

        colored_print( id, "^x04[ZP]^x01 You became Nemesis!" )

        set_task( get_pcvar_float( pcvar_hudtime ), "nemesis_message", id )
    }
    return PLUGIN_HANDLED
}

public nemesis_message( id )
{
    new szName[ 32 ]
    get_user_name( id, szName, 31 )
    set_hudmessage( 255, 0, 0, 0.05, 0.45, 1, 0.0, 5.0, 1.0, 1.0, -1 )
    show_hudmessage( 0, "%s buy Nemesis!", szName )
}

stock colored_print( target, const message[],  any:... )
{
    static buffer[ 512 ]

    if( !target )
    {
        static player
        for( player = 1; player <= g_maxplayers; player++ )
        {
            if ( !is_user_connected( player ) )
                continue;
            
            vformat( buffer, charsmax( buffer ), message, 3 )
            
            message_begin( MSG_ONE_UNRELIABLE, g_msgSayText, _, player )
            write_byte( player )
            write_string( buffer )
            message_end()
        }
    }

    else
    {
        vformat( buffer, charsmax( buffer ), message, 3 )
        
        message_begin( MSG_ONE, g_msgSayText, _, target )
        write_byte( target )
        write_string( buffer )
        message_end()
    }
}


Отредактировал: Slackerok, - 31.3.2013, 15:40
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 15:49
Сообщение #13


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

да, забыл, надо добавить в него native zp_is_restricted(); (куда-нибудь не в функцию) чтобы плагин понимал что это натив =)

UPD:
g_notcleanround = (g_nemround || g_survround || g_swarmround || g_plagueround || g_sniperround ||g_assassinround || g_lnjround)
Nightmare Round не знаю, а два других вон написаны =)


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 16:09
Сообщение #14
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Скомпилился)

Может в плагинах mod_assassins_vs_snipers и mod_nightmare можно найти их названия чтобы сервер понимал какие моды были?

Или может создать названия модов?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 16:29
Сообщение #15


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

вопрос не понял =) Я уже сегодня видимо не буду писать плагины =)


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 16:49
Сообщение #16
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Еще немножечко и все хД

Сервер ведь понимает эти раунды:

g_notcleanround = (g_nemround || g_survround || g_swarmround || g_plagueround || g_sniperround ||g_assassinround || g_lnjround)

Можно как-то плагины с первого поста ( mod_assassins_vs_snipers и mod_nightmare ) отредактировать чтобы было возможность определить их как, например:

g_nightmareround || g_avsround

Да и еще хотел спросить: Мне нужно ночью чтобы был доступен лишь мод Nemesis. Чтобы он работал удалить строку из плагина покупки?

Код
if(restricted == 1 )
{
       colored_print( id, "^x04[ZP]^x01 This mod allowed to buy only from ^x0410.00^x01 to ^x0422.00^x01 !" )
            return ZP_PLUGIN_HANDLED


Отредактировал: Slackerok, - 31.3.2013, 16:55
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 17:54
Сообщение #17
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

mazdan, Еще остался запрет покупки через карту, и плагин можно сказать что на 100 % доделан) Поможете сегодня?) Просто завтра понедельник, начинаются рабочие дни, помощи еще неделю ждать не хочется psych.gif
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя mazdan
сообщение 31.3.2013, 18:14
Сообщение #18


Иконка группы

Стаж: 15 лет

Сообщений: 7566
Благодарностей: 5437
Полезность: 1305

вы всё усложняете, сразу нужно всё было писать, теперь я уже не трезв и так легко не отвечу - вникать лень


Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 2 раз
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 31.3.2013, 18:58
Сообщение #19
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

Приятного отдыха :D Оставим на потом эти плагины. Спасибо вам огромное за помощь drinks.gif
Главное что все работает как надо на сервере) Вот жду 22 часов чтобы увидеть результат, та же лень запрещает мне изменить время и протестить раньше))

Отредактировал: Slackerok, - 31.3.2013, 19:16
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Slackerok
сообщение 1.4.2013, 10:51
Сообщение #20
Стаж: 16 лет

Сообщений: 187
Благодарностей: 20
Полезность: 12

mazdan, Здравствуйте!

Протестил после 22.00 плагины, ночной запрет не работает. Можно покупать любой мод в любое время..

Отредактировал: Slackerok, - 1.4.2013, 10:51
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
7 страниц V   1 2 ... 5 6 »
 
Тема закрытаНачать новую тему
 
0 пользователей и 2 гостей читают эту тему: