Ограничить покупку модов ( Zombie Plague Advanced ), Во времени ( ночное ) / через 1 раунд / через 1 карту |
Здравствуйте, гость Вход | Регистрация
Наши новости:
|
|
|
Ограничить покупку модов ( Zombie Plague Advanced ), Во времени ( ночное ) / через 1 раунд / через 1 карту |
Slackerok
|
25.3.2013, 21:13
Сообщение
|
|
|
Всем привет! Парни помогите реализовать эти ограничения. На сервере есть плагины которые позволяют покупать моды за аммо паки: 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Заранее спасибо и желаю Всем хорошего вечера!
Отредактировал: Slackerok, - 27.3.2013, 21:53
|
|
|
|
mazdan
|
31.3.2013, 8:21
Сообщение
|
![]() ![]() |
Мне не хочется в такой куче кода искать нужное место
https://c-s.net.ua/forum/topic50723.html тут написано как примерно сделать функция чтобы выполнялась только в определенные часы. ![]() Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
|
Поблагодарили 1 раз
|
|
mazdan
|
31.3.2013, 16:29
Сообщение
|
![]() ![]() |
вопрос не понял =) Я уже сегодня видимо не буду писать плагины =)
![]() Не пишите мне в ЛС. Пишите на почту. В ЛС я пропускаю сообщения.
|
Поблагодарили 1 раз
|
|
![]() ![]() |