Zplague
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Zplague Entrar

Seu portal de Zombie Plague no Brasil


description[ZP] Snipers vs Nemesis Mode Empty[ZP] Snipers vs Nemesis Mode

more_horiz
Assassino vs Snipers gamemod e mudou para Nemesis vs Snipers!

Código:

/*================================================================================
   
   -----------------------------------------
   -*- [ZP] Game Mode: Sniper vs Nemesis -*-
   -----------------------------------------
   
   This plugin is part of Zombie Plague Mod and is distributed under the
   terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
   
================================================================================*/

#include <amxmodx>
#include < fun >
#include <amx_settings_api>
#include <cs_teams_api>
#include <zp50_gamemodes>
#include <zp50_class_nemesis>
#include <zp50_class_sniper>
#include <zp50_deathmatch>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_armageddon[][] = { "zombie_plague/nemesis1.wav" , "zombie_plague/survivor1.wav" }

#define SOUND_MAX_LENGTH 64

new Array:g_sound_armageddon

// HUD messages
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 0
#define HUD_EVENT_G 50
#define HUD_EVENT_B 200

new g_MaxPlayers
new g_HudSync

new cvar_svnm_chance, cvar_svnm_min_players
new cvar_svnm_ratio
new cvar_svnm_nemesis_hp_multi, cvar_svnm_sniper_hp_multi
new cvar_svnm_show_hud, cvar_svnm_sounds
new cvar_svnm_allow_respawn

public plugin_precache()
{
   // Register game mode at precache (plugin gets paused after this)
   register_plugin("[ZP] Game Mode: Sniper vs Nemesis", ZP_VERSION_STRING, "ZP Dev Team")
   zp_gamemodes_register("Snipers vs Nemesis Mode")
   
   // Create the HUD Sync Objects
   g_HudSync = CreateHudSyncObj()
   
   g_MaxPlayers = get_maxplayers()
   
   cvar_svnm_chance = register_cvar("zp_svnm_chance", "20")
   cvar_svnm_min_players = register_cvar("zp_svnm_min_players", "0")
   cvar_svnm_ratio = register_cvar("zp_svnm_ratio", "0.5")
   cvar_svnm_nemesis_hp_multi = register_cvar("zp_svnm_nemesis_hp_multi", "0.25")
   cvar_svnm_sniper_hp_multi = register_cvar("zp_svnm_sniper_hp_multi", "0.25")
   cvar_svnm_show_hud = register_cvar("zp_svnm_show_hud", "1")
   cvar_svnm_sounds = register_cvar("zp_svnm_sounds", "1")
   cvar_svnm_allow_respawn = register_cvar("zp_svnm_allow_respawn", "1")
   
   // Initialize arrays
   g_sound_armageddon = ArrayCreate(SOUND_MAX_LENGTH, 1)
   
   // Load from external file
   amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND SVNM", g_sound_armageddon)
   
   // If we couldn't load custom sounds from file, use and save default ones
   new index
   if (ArraySize(g_sound_armageddon) == 0)
   {
      for (index = 0; index < sizeof sound_armageddon; index++)
         ArrayPushString(g_sound_armageddon, sound_armageddon[index])
      
      // Save to external file
      amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND SVNM", g_sound_armageddon)
   }
   
   // Precache sounds
   new sound[SOUND_MAX_LENGTH]
   for (index = 0; index < ArraySize(g_sound_armageddon); index++)
   {
      ArrayGetString(g_sound_armageddon, index, sound, charsmax(sound))
      if (equal(sound[strlen(sound)-4], ".mp3"))
      {
         format(sound, charsmax(sound), "sound/%s", sound)
         precache_generic(sound)
      }
      else
         precache_sound(sound)
   }
}

// Deathmatch module's player respawn forward
public zp_fw_deathmatch_respawn_pre(id)
{
   // Respawning allowed?
   if (!get_pcvar_num(cvar_svnm_allow_respawn))
      return PLUGIN_HANDLED;
   
   return PLUGIN_CONTINUE;
}

public zp_fw_gamemodes_choose_pre(game_mode_id, skipchecks)
{
   if (!skipchecks)
   {
      // Random chance
      if (random_num(1, get_pcvar_num(cvar_svnm_chance)) != 1)
         return PLUGIN_HANDLED;
      
      // Min players
      if (GetAliveCount() < get_pcvar_num(cvar_svnm_min_players))
         return PLUGIN_HANDLED;
   }
   
   // Game mode allowed
   return PLUGIN_CONTINUE;
}

public zp_fw_gamemodes_start()
{
   // Calculate player counts
   new id, alive_count = GetAliveCount()
   new sniper_count = floatround(alive_count * get_pcvar_float(cvar_svnm_ratio), floatround_ceil)
   new nemesis_count = alive_count - sniper_count
   
   // Turn specified amount of players into sniper
   new isniper, iMaxsniper = sniper_count
   while (isniper < iMaxsniper)
   {
      // Choose random guy
      id = GetRandomAlive(random_num(1, alive_count))
      
      // Already a sniper?
      if (zp_class_sniper_get(id))
         continue;
      
      // If not, turn him into one
      zp_class_sniper_set(id)
      isniper++
      
      // Apply sniper health multiplier
      set_user_health(id, floatround(get_user_health(id) * get_pcvar_float(cvar_svnm_sniper_hp_multi)))
   }
   
   // Turn specified amount of players into Nemesis
   new inemesis, iMaxnemesis = nemesis_count
   while (inemesis < iMaxnemesis)
   {
      // Choose random guy
      id = GetRandomAlive(random_num(1, alive_count))
      
      // Already a sniper or nemesis?
      if (zp_class_sniper_get(id) || zp_class_nemesis_get(id))
         continue;
      
      // If not, turn him into one
      zp_class_nemesis_set(id)
      inemesis++
      
      // Apply nemesis health multiplier
      set_user_health(id, floatround(get_user_health(id) * get_pcvar_float(cvar_svnm_nemesis_hp_multi)))
   }
   
   // Play Armageddon sound
   if (get_pcvar_num(cvar_svnm_sounds))
   {
      new sound[SOUND_MAX_LENGTH]
      ArrayGetString(g_sound_armageddon, random_num(0, ArraySize(g_sound_armageddon) - 1), sound, charsmax(sound))
      PlaySoundToClients(sound)
   }
   
   if (get_pcvar_num(cvar_svnm_show_hud))
   {
      // Show Armageddon HUD notice
      set_hudmessage(HUD_EVENT_R, HUD_EVENT_G, HUD_EVENT_B, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
      ShowSyncHudMsg(0, g_HudSync, "%L", LANG_PLAYER, "NOTICE_SVNM")
   }
}

// Plays a sound on clients
PlaySoundToClients(const sound[])
{
   if (equal(sound[strlen(sound)-4], ".mp3"))
      client_cmd(0, "mp3 play ^"sound/%s^"", sound)
   else
      client_cmd(0, "spk ^"%s^"", sound)
}

// Get Alive Count -returns alive players number-
GetAliveCount()
{
   new iAlive, id
   
   for (id = 1; id <= g_MaxPlayers; id++)
   {
      if (is_user_alive(id))
         iAlive++
   }
   
   return iAlive;
}

// Get Random Alive -returns index of alive player number target_index -
GetRandomAlive(target_index)
{
   new iAlive, id
   
   for (id = 1; id <= g_MaxPlayers; id++)
   {
      if (is_user_alive(id))
         iAlive++
      
      if (iAlive == target_index)
         return id;
   }
   
   return -1;
}


Se houver qualquer erro com gamemod aviso texto hud você pode corrigi-lo facilmente! Siga os seguintes passos:

- Vá para o diretório do jogo> addons> amxmodx> dados> lang> zombie_plague.txt
- Adicione uma nova linha: NOTICE_SVNM = Snipers vs Nemesis Modo!

Créditos:
MeRcyLeZZ: Para tal modo impressionante como Zombie Plague
ESPANDONGAMING: Para fazer o modo de atiradores assassinos vs sniper
happy_2012: Re-codificação e mudando gamemod

Saiba mais em : https://forums.alliedmods.net/showthread.php?t=223561

description[ZP] Snipers vs Nemesis Mode EmptyRe: [ZP] Snipers vs Nemesis Mode

more_horiz
afff pra 5.0 queria pra 4.5

description[ZP] Snipers vs Nemesis Mode EmptyRe: [ZP] Snipers vs Nemesis Mode

more_horiz
Feelipe:: escreveu:
afff pra 5.0 queria pra 4.5
não tem essa de 4.5 é 4.3 ou advanced

description[ZP] Snipers vs Nemesis Mode EmptyRe: [ZP] Snipers vs Nemesis Mode

more_horiz
Biel-oGrande escreveu:
Feelipe:: escreveu:
afff pra 5.0 queria pra 4.5
não tem essa de 4.5 é 4.3 ou advanced

Quem disse que não tem essa pra advance.

SMA do Sniper vs Nemesis para Advance:

Código:

#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[] = "l"

// 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/nemesis1.wav" ,
   "zombie_plague/survivor1.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/ambience.wav"
}

// Duration in seconds of each sound
new const Float:g_sound_ambience_duration[] = { 58.0 , 56.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_nemhp, g_msg_sync

// Ambience sounds task
#define TASK_AMB 3256

public plugin_init( )
{
   // Plugin registeration.
   register_plugin( "[ZP] Nemesis vs Snipers Mode","1.0", "@bdul! | [P]erfec[T] [S]cr[@]s[H]" )
   
   // Register some cvars
   // Edit these according to your liking
   cvar_minplayers = register_cvar("zp_nvsm_minplayers", "2")
   cvar_sniperhp =     register_cvar("zp_nvsm_sniper_hp", "1.0")
   cvar_nemhp =     register_cvar("zp_nvsm_nemesis_hp", "0.2")
   cvar_ratio =      register_cvar("zp_nvsm_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( "Nemesis 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 nemesis instead
         zp_make_user_nemesis( id )
         
         // Set his health
         set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )
      }
      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_nvs_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, "Nemesis 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_nvs_mode( )
   
   // Make the compiler happy again =)
   return PLUGIN_CONTINUE
}

// This function contains the whole code behind this game mode
start_nvs_mode( )
{
   // Create and initialize some important vars
   static i_nemesis, i_max_nemesis, id, i_alive
   i_alive = fn_get_alive_players()
   id = 0
   
   // Get the no of players we have to turn into nemesis
   i_max_nemesis = floatround( ( i_alive * get_pcvar_float( cvar_ratio ) ), floatround_ceil )
   i_nemesis = 0
   
   // Randomly turn players into nemesis
   while (i_nemesis < i_max_nemesis)
   {
      // 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 nemesis
         zp_make_user_nemesis(id)
         
         // Set his health
         set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_nemhp)) )
         
         // Increase counter
         i_nemesis++
      }
   }
   
   // Turn the remaining players into snipers
   for (id = 1; id <= g_maxplayers; id++)
   {
      // Only those of them who are alive and are not nemesis
      if ( !is_user_alive(id) || zp_get_user_nemesis(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 )
   client_cmd(winteam, "mp3 stop")   // Para nao bugar o som quando o round acabar caso seja em Mp3
}
#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;
}

description[ZP] Snipers vs Nemesis Mode EmptyRe: [ZP] Snipers vs Nemesis Mode

more_horiz
não disse que não tinha pra advanced

description[ZP] Snipers vs Nemesis Mode EmptyRe: [ZP] Snipers vs Nemesis Mode

more_horiz
privacy_tip Permissões neste sub-fórum
Não podes responder a tópicos
power_settings_newInicie sessão para responder