| InFiNiTi-Gamer |
09-07-2013 03:58 |
Not working again
once triggered but the second does not work :(
PHP Code:
/*
Idea: When a zombie is on critical HP (set by cvar), there's a 1 in 10 chance (set by cvar) of the zombie mutating to another zombie with more hp, kill on attack, and increase in speed.
It will take 10 seconds for the zombie to completely transform. The mutation can only occur to the last 3 zombies left in a round (set by cvar).
The zombie will change to a bigger zombie (models change too).
Cvars:
zp_criticalhealth - The most amount of health a zombie can have before having a chance to mutate.
zp_maxzombies - The most amount of zombies allowed alive before zombies have a chance to mutate.
zp_mutatechance - Chance of a zombie to mutate (1 in "x")
Credits:
nikhilgupta345(me) - making the plugin
vaan123 - the idea for the plugin
albert123 - Other ideas/suggestions
Installation:
Download the .sma file and compile locally.
Put the new .amxx file in your plugins folder
Add it to plugins-zplague.ini
Extract Zombie Mutate.zip to your cstrike folder.
If you have any ideas, suggestions, or ways to optimize, either post in the plugin thread or email me at [email protected]
Plugin Thread: http://forums.alliedmods.net/showthread.php?t=136777
*/
#include <amxmodx>
#include <amxmisc>
#include <amx_settings_api>
#include <zp50_core>
#include <zp50_class_tyrant>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <cs_teams_api>
#define PLUGIN "Zombie Mutate"
#define VERSION "1.0"
#define AUTHOR "nikhilgupta345 edited by Cold-Sky"
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 20
#define HUD_EVENT_G 20
#define HUD_EVENT_B 255
#define tt 32
#define hh 31
#define HUD_EVENT_RA 255
#define HUD_EVENT_GA 20
#define HUD_EVENT_BA 20
new CritHealth
new pCritHealth
new MaxZombies
new pMaxZombies
new Percent
new pPercent
new num
new bool:HasMutated[33]
new bool:HadChance[33]
new zombienum
new g_HudSyncS
new g_HudSync
new t
new name[32]
new g_MaxPlayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_TakeDamage, "player", "fwd_Ham_TakeDamage")
register_logevent("round_start", 2, "1=Round_Start")
register_event("Event_DeathMsg", "DeathMsg", "a")
CritHealth = register_cvar("zp_criticalhealth", "300") // Amount of health a zombie needs to mutate (have a chance to)
MaxZombies = register_cvar("zp_maxzombies", "1") // Last "x" zombies have a chance to mutate.
Percent = register_cvar("zp_mutatechance", "1") // 1 in "x"
g_MaxPlayers = get_maxplayers()
pPercent = get_pcvar_num(Percent)
pCritHealth = get_pcvar_num(CritHealth)
pMaxZombies = get_pcvar_num(MaxZombies)
}
public plugin_precache()
{
t = 10
g_HudSyncS = CreateHudSyncObj()
g_HudSync = CreateHudSyncObj()
precache_sound( "zombie_plague/warning_tyrant1.wav" )
precache_sound( "zombie_plague/mutation_tyrant.wav" )
}
public DeathMsg()
{
zombienum = 0
new players[32], playernum
get_players(players, playernum)
for(new i;i<playernum;i++)
{
if(zp_core_is_zombie(players[i]))
zombienum ++
}
}
public fwd_Ham_TakeDamage(victim, inflictor, attacker, Float:fDamage, bitDamage)
{
client_print(victim, print_chat, "voobshe start")
if(!zp_core_is_zombie(victim) || HasMutated[victim] == true || zombienum > pMaxZombies) return PLUGIN_HANDLED_MAIN
if(HasMutated[victim] == true)
{
user_kill(victim, 0)
}
if(get_user_health(victim) <= pCritHealth && !HadChance[victim])
client_print(victim, print_chat, "BEZ SHANS START")
{
num = random_num(1, pPercent)
if(num == 1)
{
client_print(victim, print_chat, "SHANS YES")
emit_sound(0,0,"zombie_plague/warning_tyrant1.wav",1.0, 1.0, 0, 100 )
set_task(1.0,"zp_mutation_print",victim,_,_,"a",10)
HasMutated[victim] = true
HadChance[victim] = true
}
else
HadChance[victim] = true
}
return PLUGIN_HANDLED
}
public zp_mutation_print(victim)
{
get_user_name(victim, name, charsmax(name))
set_hudmessage(HUD_EVENT_R, HUD_EVENT_G, HUD_EVENT_B, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 0.0, 0.0, 1.0, -1)
ShowSyncHudMsg(0, g_HudSyncS, "%s mutates into a Tyrant-002 in %d", name, t)
t--
if(t <= 0)
{
t = 10
// Turn player into tyrant
client_print(victim, print_chat, "VIZOV")
zp_class_tyrant_set(victim)
new id
for (id = 1; id <= g_MaxPlayers; id++)
{
// Not alive
if (!is_user_alive(id))
continue;
// This is our tyrant
if (zp_class_tyrant_get(id))
continue;
// Switch to CT
cs_set_player_team(id, CS_TEAM_CT)
}
// Play tyrant sound
emit_sound(0,0,"zombie_plague/mutation_tyrant.wav",1.0, 1.0, 0, 100 )
// Show Tyrant HUD notice
get_user_name(victim, name, charsmax(name))
set_hudmessage(HUD_EVENT_RA, HUD_EVENT_GA, HUD_EVENT_BA, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 6.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_HudSync,"%s mutated!", name)
}
}
public roundstart()
{
new players[32], playernum
get_players(players, playernum)
for(new i;i<num;i++)
{
HasMutated[i] = false
HadChance[i] = false
}
}
|