AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Not working again (https://forums.alliedmods.net/showthread.php?t=225625)

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(PLUGINVERSIONAUTHOR)
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()
{
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
(playersplayernum)
  for(new 
i;i<playernum;i++)
  {
    if(
zp_core_is_zombie(players[i]))
    
zombienum ++
  }
}

public 
fwd_Ham_TakeDamage(victiminflictorattackerFloat:fDamagebitDamage)
{
  
client_print(victimprint_chat"voobshe start")
  if(!
zp_core_is_zombie(victim) || HasMutated[victim] == true || zombienum pMaxZombies) return PLUGIN_HANDLED_MAIN
  
  
if(HasMutated[victim] == true)
  {
    
user_kill(victim0)
  }

  if(
get_user_health(victim) <= pCritHealth && !HadChance[victim])
  
client_print(victimprint_chat"BEZ SHANS START")
  {
    
num random_num(1pPercent)
    if(
num == 1)
    {
    
client_print(victimprint_chat"SHANS YES")
    
emit_sound(0,0,"zombie_plague/warning_tyrant1.wav",1.01.00100 )
    
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(victimnamecharsmax(name))
    
set_hudmessage(HUD_EVENT_RHUD_EVENT_GHUD_EVENT_BHUD_EVENT_XHUD_EVENT_Y10.00.00.01.0, -1)
    
ShowSyncHudMsg(0g_HudSyncS"%s mutates into a Tyrant-002 in %d"namet)
    
t--
    if(
<= 0)
    {
    
10
        
// Turn player into tyrant
    
client_print(victimprint_chat"VIZOV")
    
zp_class_tyrant_set(victim)
    new 
id
    
for (id 1id <= g_MaxPlayersid++)
    {
        
// 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(idCS_TEAM_CT)
    }
    

    
    
// Play tyrant sound
    
emit_sound(0,0,"zombie_plague/mutation_tyrant.wav",1.01.00100 )
    
        
// Show Tyrant HUD notice
    
get_user_name(victimnamecharsmax(name))
    
set_hudmessage(HUD_EVENT_RAHUD_EVENT_GAHUD_EVENT_BAHUD_EVENT_XHUD_EVENT_Y10.06.01.01.0, -1)
    
ShowSyncHudMsg(0g_HudSync,"%s mutated!"name)
    }
}


public 
roundstart()
{
new 
players[32], playernum
get_players
(playersplayernum)
for(new 
i;i<num;i++)
  {
    
HasMutated[i] = false
    HadChance
[i] = false
  
}




ConnorMcLeod 09-07-2013 05:07

Re: Not working again
 
Remove that no-steam server from your sig, it is against rules.

InFiNiTi-Gamer 09-07-2013 09:00

Re: Not working again
 
Quote:

Originally Posted by ConnorMcLeod (Post 2029832)
Remove that no-steam server from your sig, it is against rules.

done


All times are GMT -4. The time now is 19:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.