Bom galera, ontem eu tava brincando de editar modos, e fis um aki bem legal e zuado, porem legal
Nome : Hora da Vingança
Descrição : 1 Player vira Nemesis(ou outra classe aleatoria)
E o resto do Servidor vira Survivor(ou outra classe aleatoria)
Sma:
Código:
#include < amxmodx >
#include < fun >
#include < zpa_new_modes >
new const g_chance = 15
new const g_access_flag[] = "a"
new const g_play_sounds[][] =
{
"zombie_plague/nemesis1.wav" ,
"zombie_plague/survivor1.wav"
}
#define AMBIENCE_SOUNDS
#if defined AMBIENCE_SOUNDS
new const g_sound_ambience[][] =
{
"zombie_plague/ambience.wav"
}
new const Float:g_sound_ambience_duration[] = { 58.0 , 56.0 }
#endif
new g_gameid, g_maxplayers, cvar_minplayers, cvar_ratio, cvar_berhp, cvar_assahp, g_msg_sync
#define TASK_AMB 3256
public plugin_init( )
{
register_plugin( "[ZP] Hora da \rVinganca","1.0", "Nao sei quem | TNT" )
cvar_minplayers = register_cvar("zp_avsb_minplayers", "2")
cvar_berhp = register_cvar("zp_avsb_berseker_hp", "1.5")
cvar_assahp = register_cvar("zp_avsb_assassin_hp", "1.0")
cvar_ratio = register_cvar("zp_avsb_inf_ratio", "0.5")
g_maxplayers = get_maxplayers( )
g_msg_sync = CreateHudSyncObj()
}
public plugin_precache( )
{
new access_flag = read_flags( g_access_flag )
new i
for (i = 0; i < sizeof g_play_sounds; i++)
precache_sound( g_play_sounds[i] )
#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
g_gameid = zp_register_game_mode( "Hora da Vinganca ", access_flag, g_chance, 0, ZP_DM_BALANCE )
}
public zp_player_spawn_post( id )
{
if( zp_get_current_mode() == g_gameid )
{
if( zp_get_user_zombie( id ))
{
zp_make_user_assassin( id )
zp_make_user_predator( id )
zp_make_user_nemesis( id )
set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_assahp)) )
}
else
{
zp_make_user_berserker( id )
zp_make_user_sniper( id )
zp_make_user_survivor( id )
set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_berhp)) )
}
}
}
public zp_round_started_pre( game )
{
if( game == g_gameid )
{
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_avs_mode( )
}
return PLUGIN_CONTINUE
}
public zp_round_started( game, id )
{
if( game == g_gameid )
{
set_hudmessage(221, 156, 21, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_msg_sync, "Hora da Vinganca^nE AGORA NEMESIS ???^n^n^n^nby TNT")
client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
remove_task( TASK_AMB )
#if defined AMBIENCE_SOUNDS
set_task( 2.0, "start_ambience_sounds", TASK_AMB )
#endif
}
}
public zp_game_mode_selected( gameid, id )
{
if( gameid == g_gameid )
start_avs_mode( )
return PLUGIN_CONTINUE
}
start_avs_mode( )
{
static i_assassins, i_max_assassins, id, i_alive
i_alive = fn_get_alive_players()
id = 0
i_max_assassins = floatround( ( i_alive * get_pcvar_float( cvar_ratio ) ), floatround_ceil )
i_assassins = 0
while (i_assassins < i_max_assassins)
{
if ( (++id) > g_maxplayers) id = 1
if ( !is_user_alive(id) )
continue;
if (random_num(1, 5) == 1)
{
zp_make_user_assassin(id)
zp_make_user_predator(id)
zp_make_user_nemesis(id)
set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_assahp)) )
i_assassins++
}
}
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;
zp_make_user_berserker(id)
zp_make_user_sniper(id)
zp_make_user_survivor(id)
set_user_health( id, floatround(get_user_health(id) * get_pcvar_float(cvar_berhp)) )
}
}
#if defined AMBIENCE_SOUNDS
public start_ambience_sounds( )
{
static amb_sound[64], sound, Float:duration
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 ]
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 )
set_task( duration, "start_ambience_sounds", TASK_AMB )
}
public zp_round_ended( winteam )
{
remove_task( TASK_AMB )
}
#endif
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;
}
Última edição por MasterUnltd em 10/12/2013, 3:55 pm, editado 1 vez(es)