I create nemesis plugin but not work [Help]

Coding Help/Re-API Supported
User avatar
lizoumapper
Senior Member
Senior Member
Morocco
Posts: 150
Joined: 9 Months Ago
Location: Morocco
Has thanked: 3 times
Been thanked: 7 times
Age: 17
Contact:

I create nemesis plugin but not work [Help]

#1

Post by lizoumapper » 1 Month Ago

Hi
i create plugin nemesis to more fun
not work
any one help me i try but not work
i make chance 1 to test when become nemesis work i change it to 10

Code: Select all

/*
	I create plugin nemesis round to fun 
	to work nemesis you need add plugin ze_leap (ze_leap.amxx)
*/

/* -- Included -- */  
#include <zombie_escape>
#include <cstrike>
#include <fun>

/* -- Definded -- */
#define PLAYERMODEL_MAX_LENGTH 32
#define MODEL_MAX_LENGTH 64

/* -- Variable Cvars -- */ 
new Cvar_Nemesis_Chance
new Cvar_Nemesis_Health
new Cvar_Nemesis_Gravity
new Cvar_Nemesis_Speed
new Cvar_Nemesis_Glow
new Cvar_Nemesis_Leap
new Cvar_Nemesis_Sound
new Cvar_Nemesis_HudInfo
new Cvar_Nemesis_Damage

/* -- Global Variable -- */ 
new g_MaxPlayers

/* -- Bool Variable -- */
new g_IsNemesis


/* -- Natives -- */
native ze_get_longjump(id)
native ze_remove_longjump(id)

/* -- Custom Model -- */
// Settings file
new const ZE_SETTING_FILE[] = "zombie_escape.ini"

/*-- Default models --*/
new const models_nemesis_player[][] = { "ze_nemesis_host" }
new const models_nemesis_claw[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }

/* -- Array -- */
new Array:g_models_nemesis_player
new Array:g_models_nemesis_claw

/* -- Sound Nemesis -- */
new const Snd_Nemesis[] = "sound/zombie_escape/ze_nemesis.wav"

/* ------------------ */
public plugin_init() 
{
	register_plugin("[ZE] Nemesis Class", "1.0.0", AUTHORS)

	// Other Cvar
	register_clcmd("ze_nemesis_round", "ze_round_nemesis", _, "Round Nemesis", ADMIN_KICK) 
	
	// Ham Take Damage 
	RegisterHam( Ham_TakeDamage, "player", "TakeDamage" );
	
	// Max Players 
	g_MaxPlayers = get_maxplayers()
	
	// Cvars 
	Cvar_Nemesis_Chance = register_cvar("ze_nemesis_chance", "1")
	Cvar_Nemesis_Health = register_cvar("ze_nemsis_health", "50000")
	Cvar_Nemesis_Gravity = register_cvar("ze_nemesis_gravity", "650.0")
	Cvar_Nemesis_Speed = register_cvar("ze_nemesis_speed", "1.6")
	Cvar_Nemesis_Glow = register_cvar("ze_nemesis_glow", "1")
	Cvar_Nemesis_Leap = register_cvar("ze_nemesis_leap", "1")
	Cvar_Nemesis_Sound = register_cvar("ze_nemesis_sound", "1")
	Cvar_Nemesis_HudInfo = register_cvar("ze_nemesis_hudinfo", "1")
	Cvar_Nemesis_Damage = register_cvar("ze_nemesis_damage", "25.0")
	
	// Precache Lang Text
	register_dictionary("zombie_escape.txt")
}

/* -- Precache Files -- */
public plugin_precache()
{
	// Initialize arrays
	g_models_nemesis_player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
	g_models_nemesis_claw = ArrayCreate(MODEL_MAX_LENGTH, 1)
	
	// Load from external file
	amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_models_nemesis_player)
	amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_models_nemesis_claw)
	
	// If we couldn't load from file, use and save default ones
	new index
	if (ArraySize(g_models_nemesis_player) == 0)
	{
		for (index = 0; index < sizeof models_nemesis_player; index++)
			ArrayPushString(g_models_nemesis_player, models_nemesis_player[index])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_models_nemesis_player)
	}
	if (ArraySize(g_models_nemesis_claw) == 0)
	{
		for (index = 0; index < sizeof models_nemesis_claw; index++)
			ArrayPushString(g_models_nemesis_claw, models_nemesis_claw[index])
		
		// Save to external file
		amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_models_nemesis_claw)
	}
	
	// Precache models
	new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
	for (index = 0; index < ArraySize(g_models_nemesis_player); index++)
	{
		ArrayGetString(g_models_nemesis_player, index, player_model, charsmax(player_model))
		formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
		precache_model(model_path)
		// Support modelT.mdl files
		formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
		if (file_exists(model_path)) precache_model(model_path)
	}
	for (index = 0; index < ArraySize(g_models_nemesis_claw); index++)
	{
		ArrayGetString(g_models_nemesis_claw, index, model, charsmax(model))
		precache_model(model)
	}
}

/* -- Register Natives -- */
public plugin_natives()
{
	register_native("ze_is_user_nemesis", "_native_is_nemesis")
}

public _native_is_nemesis(id)
{
	return g_IsNemesis
}

/* -- Player Disconnected Server -- */
public client_disconnected(id)
{
	g_IsNemesis = false
}

/* -- Start Round Nemesis -- */
public ze_round_nemesis(id)
{
	g_IsNemesis = false
	return 1;
}

/* -- New Round -- */
public ze_newround(id)
{
	if(random_num(1, (Cvar_Nemesis_Chance)) != 1)
	{
		g_IsNemesis = true
	}
}

/* -- Zombie Choosed -- */
public ze_zombie_appear()
{
	if(g_IsNemesis)
	{
		for(new id = 0;id < g_MaxPlayers;id++)
		{
			// start feature nemesis
			nemesis_feature(id)
	
			// start hud + sound nemesis
			nemesis_message(id)		
		}
	}
	
	return 1;
}

/* -- Nemesis Features -- */
public nemesis_feature(id)
{	
	if(is_user_alive(id) && g_IsNemesis)
	{
		// Message notice log jump is active 
		if(get_pcvar_num(Cvar_Nemesis_Leap) == 1)
		{
			ze_colored_print(0, "You Have ^4Long Jump^1, ^3Crouch + Jump")
		}
		
		// Feature Nemesis [HP + Gravity + Speed ] 
		set_user_health(id, get_pcvar_num(Cvar_Nemesis_Health)) // Health
		set_user_gravity(id, get_pcvar_float(Cvar_Nemesis_Gravity)) // Gravity
		set_user_maxspeed(id, get_pcvar_float(Cvar_Nemesis_Speed)) // Speed
			
		// Glow 
		if(get_pcvar_num(Cvar_Nemesis_Glow) == 1)
		{
			Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
		}
				
		if(get_pcvar_num(Cvar_Nemesis_Leap) == 1)
		{
			ze_get_longjump(id)
		}
	}
	
	set_model(id) // Set Model Nemesis
	
	return 1;

}

/* -- Make Nemesis Killer -- */ 
public TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage, iDamageBits )
{
    if(iInfector == iAttacker && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && !g_IsNemesis == true)
    {
        SetHamParamFloat(4, iDamage * get_pcvar_float(Cvar_Nemesis_Damage))
        return HAM_HANDLED;
    }
    return HAM_IGNORED;
} 
		

/* -- Message Nemesis -- */
public nemesis_message(id)
{
	if(get_pcvar_num(Cvar_Nemesis_Sound))
	{
		// Notice Sound
		client_cmd(id, "spk %s", Snd_Nemesis)
	}
	
	if(get_pcvar_num(Cvar_Nemesis_HudInfo))
	{	
		// Hud Message Nemesis
		static NNemesis[64]
		formatex(NNemesis, charsmax(NNemesis), "%L", LANG_PLAYER, "NOTICE_NEMESIS")
		set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5, false)
		show_hudmessage(id, NNemesis)
		
		// Chat Message Nemesis
		static NNemesisChat[64]
		formatex(NNemesisChat, charsmax(NNemesisChat), "%L", LANG_PLAYER, "NOTICE_NEMESIS_CHAT")
		ze_colored_print(id, NNemesisChat)
	}
	
	return 1;
} 	

/* -- Set Nemesis Model -- */
public set_model(id)
{
	if(g_IsNemesis)
	{
		// Apply nemesis player model
		new player_model[PLAYERMODEL_MAX_LENGTH]
		ArrayGetString(g_models_nemesis_player, random_num(0, ArraySize(g_models_nemesis_player) - 1), player_model, charsmax(player_model))
		cs_set_user_model(id, player_model)
				
		// Apply nemesis claw model
		new model[MODEL_MAX_LENGTH]
		ArrayGetString(g_models_nemesis_claw, random_num(0, ArraySize(g_models_nemesis_claw) - 1), model, charsmax(model))
		cs_set_player_view_model(id, CSW_KNIFE, model)
	}
}

/* -- Round Ended -- */
public ze_roundend(id)
{
	Set_Rendering(id)
	g_IsNemesis = false
	ze_remove_longjump(id)
}

this is LEAP

Code: Select all

#include <zombie_escape>

#define PLUGIN "[ZE] Extra Item:Leap"
#define VERSION "1.5.7"
#define AUTHOR "Fry!"

/*================================================================================
 [Plugin Customization]
=================================================================================*/

new bool:g_hasLongJump[33],g_SayText
new Float:g_last_LongJump_time[33]
new g_LongJump_force, g_LongJump_height, g_LongJump_cooldown
public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_cvar("ze_leap",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
	
	g_LongJump_force = register_cvar("ze_longjump_force", "580")
	g_LongJump_height = register_cvar("ze_longjump_height", "320")
	g_LongJump_cooldown = register_cvar("ze_longjump_cooldown", "5.0")
	
	register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
	
	register_event("DeathMsg", "death", "a")
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	g_SayText = get_user_msgid("SayText")
}
public plugin_natives()
{
	register_native("ze_get_longjump","native_give_longjump",1)
	register_native("ze_remove_longjump","native_remove_longjump",1)
}
public native_give_longjump(id)
{
	if(ze_is_user_zombie(id))
	{
		g_hasLongJump[id] = true
	}
	else
	{
		g_hasLongJump[id] = false
	}
}

public native_remove_longjump(id)
{
	g_hasLongJump[id] = false
}

stock Color(const id, const input[], any:...)
{
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!t", "^3")
	
	message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, id)
	write_byte(id)
	write_string(msg)
	message_end()
}
// Reset on disconnection
public client_disconnected(id)
{
	g_hasLongJump[id] = false
}

// Reset on death
public death()
{
	g_hasLongJump[read_data(2)] = false
}

// Reset if turned into human
public ze_user_humanized(id)
{
	g_hasLongJump[id] = false
}

// Reset at round start (for everyone)
public event_round_start()
{
	for (new i = 1; i <= 32; i++)
		g_hasLongJump[i] = false
}	
public fw_PlayerPreThink(id)
{
	if (!is_user_alive(id))
		return FMRES_IGNORED
	
	if (allow_LongJump(id))
	{
		static Float:velocity[3]
		velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
		
		velocity[2] = get_pcvar_float(g_LongJump_height)
		
		set_pev(id, pev_velocity, velocity)
		
		g_last_LongJump_time[id] = get_gametime()
	}
	
	return FMRES_IGNORED
}

// Check if the player can longjump
allow_LongJump(id)
{
	if (!g_hasLongJump[id])
		return false
	
	if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
		return false
	
	static buttons
	buttons = pev(id, pev_button)
	
	if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
		return false
	
	if (get_gametime() - g_last_LongJump_time[id] < get_pcvar_float(g_LongJump_cooldown))
		return false
		
	if(g_last_LongJump_time[id] == get_pcvar_float(g_LongJump_cooldown))
	{
		client_print(id,print_chat,"[ZE] You can use the Leap Jump now.")
		return true
	}
	
	return true
}

// Get entity's speed (from fakemeta_util)
stock fm_get_speed(entity)
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	
	return floatround(vector_length(velocity))
}

this is Resource
Re_Nemesis.zip
Model + Claw
(1.22 MiB) Downloaded 11 times
Re_Nemesis.zip
Model + Claw
(1.22 MiB) Downloaded 11 times
I Love Learn Languages Programmations

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 399
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#2

Post by Muhammet20 » 1 Month Ago

i will creare one soon and it will work

[ Post made via Android ]
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
lizoumapper
Senior Member
Senior Member
Morocco
Posts: 150
Joined: 9 Months Ago
Location: Morocco
Has thanked: 3 times
Been thanked: 7 times
Age: 17
Contact:

#3

Post by lizoumapper » 1 Month Ago

Muhammet20 wrote:
1 Month Ago
i will creare one soon and it will work
You can fix it
this plugin is good :)
why you want create other one
try fix it

[ Post made via Android ]
I Love Learn Languages Programmations

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 622
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#4

Post by Mohamed Alaa » 1 Month Ago

I wrote the nemesis class with all features.

Note1: The code is not tested. So if anyone's willing to test, report please with ALL ERRORS & FULL DEBUG INFORMATION if found.
Note2: You have to use the leap code that you provided in the topic.
Note3: To start a nemesis round, say in console ze_start_nemesis_next and the round after the current will be nemesis round.
Note4: Configure cvars & defines.

Edit:

Sorry for this mistake.
I have fixed & tested this plugin, it should run fine now.
Feedbacks are welcomed.
  1. #include <zombie_escape>
  2.  
  3. // Uncomment to use custom model for nemesis
  4. // Note: This includes player model & claws
  5. //#define USE_NEMESIS_MODEL
  6.  
  7. // Uncomment to use leap for nemesis
  8. //#define USE_NEMESIS_LEAP
  9.  
  10. #define TASK_MAKE_HEROINE 4949849
  11.  
  12. // Access to start nemesis round
  13. #define STARTNEMESIS_ACCESS ADMIN_LEVEL_H
  14.  
  15. #if defined USE_NEMESIS_MODEL
  16. // Settings file
  17. new const ZE_SETTING_FILE[] = "zombie_escape.ini"
  18.  
  19. // Default models
  20. new const g_szModels_Nemesis_Player[][] = { "ze_nemesis_host" }
  21. new const g_szModels_Nemesis_Claws[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
  22.  
  23. new Array:g_aModels_Nemesis_Player,
  24.     Array:g_aModels_Nemesis_Claws
  25. #endif
  26.  
  27. #if defined USE_NEMESIS_LEAP
  28. native ze_get_longjump(id)
  29. native ze_remove_longjump(id)
  30. #endif
  31.  
  32. enum _:Colors
  33. {
  34.     Red = 0,
  35.     Green,
  36.     Blue
  37. }
  38.  
  39. new bool:g_bIsNemesis[33],
  40.     bool:g_bIsNextRoundNemesis = false
  41.  
  42. new g_pCvarNemesisHP,
  43.     g_pCvarNemesisGravity,
  44.     g_pCvarNemesisSpeed,
  45.     g_pCvarNemesisGlow,
  46.     g_pCvarNemesisGlowColor[Colors],
  47.     g_pCvarNemesisKB,
  48.     g_pCvarNemesisFreeze,
  49.     g_pCvarNemesisFire,
  50.     g_pCvarFreezetime
  51.  
  52. public plugin_natives()
  53. {
  54.     register_native("ze_is_user_nemesis", "native_ze_is_user_nemesis", 1)
  55.     register_native("ze_set_user_nemesis", "native_ze_set_user_nemesis", 1)
  56. }
  57.  
  58. #if defined USE_NEMESIS_MODEL
  59. public plugin_precache()
  60. {
  61.     // Initialize arrays
  62.     g_aModels_Nemesis_Player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  63.     g_aModels_Nemesis_Claws = ArrayCreate(MODEL_MAX_LENGTH, 1)
  64.    
  65.     // Load from external file
  66.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS MODEL", g_aModels_Nemesis_Player)
  67.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  68.    
  69.     // If we couldn't load from file, use and save default ones
  70.     new index
  71.  
  72.     if (ArraySize(g_aModels_Nemesis_Player) == 0)
  73.     {
  74.         for (index = 0; index < sizeof g_szModels_Nemesis_Player; index++)
  75.             ArrayPushString(g_aModels_Nemesis_Player, g_szModels_Nemesis_Player[index])
  76.        
  77.         // Save to external file
  78.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_aModels_Nemesis_Player)
  79.     }
  80.  
  81.     if (ArraySize(g_aModels_Nemesis_Claws) == 0)
  82.     {
  83.         for (index = 0; index < sizeof g_szModels_Nemesis_Claws; index++)
  84.             ArrayPushString(g_aModels_Nemesis_Claws, g_szModels_Nemesis_Claws[index])
  85.        
  86.         // Save to external file
  87.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  88.     }
  89.    
  90.     // Precache models
  91.     new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
  92.  
  93.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Player); index++)
  94.     {
  95.         ArrayGetString(g_aModels_Nemesis_Player, index, player_model, charsmax(player_model))
  96.         formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
  97.         precache_model(model_path)
  98.         // Support modelT.mdl files
  99.         formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
  100.         if (file_exists(model_path)) precache_model(model_path)
  101.     }
  102.  
  103.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Claws); index++)
  104.     {
  105.         ArrayGetString(g_aModels_Nemesis_Claws, index, model, charsmax(model))
  106.         precache_model(model)
  107.     }
  108. }
  109. #endif
  110.  
  111. public plugin_init()
  112. {
  113.     register_plugin("[ZE] Addons: Nemesis", "1.0", "Jack")
  114.  
  115.     register_clcmd("ze_start_nemesis_next", "cmd_nemesis", STARTNEMESIS_ACCESS)
  116.  
  117.     g_pCvarNemesisHP = register_cvar("ze_nemesis_hp", "20000")  // Nemesis health - Set 0 to use zombie HP
  118.     g_pCvarNemesisGravity = register_cvar("ze_nemesis_gravity", "600")  // Nemesis gravity - Set 0 to use zombie gravity
  119.     g_pCvarNemesisSpeed = register_cvar("ze_nemesis_speed", "300")  // Nemesis speed - Set 0 to use zombie speed
  120.     g_pCvarNemesisGlow = register_cvar("ze_nemesis_glow", "1")  // Nemesis glow - 1 = enable | 0 = disable
  121.     g_pCvarNemesisGlowColor[Red] = register_cvar("ze_nemesis_glow_r", "255")    // Nemesis glow color RED
  122.     g_pCvarNemesisGlowColor[Green] = register_cvar("ze_nemesis_glow_g", "255")  // Nemesis glow color GREEN
  123.     g_pCvarNemesisGlowColor[Blue] = register_cvar("ze_nemesis_glow_b", "255")   // Nemesis glow color BLUE
  124.     g_pCvarNemesisKB = register_cvar("ze_nemesis_kb", "200.0")  // Nemesis knockback - Set 0 to use zombie knockback
  125.     g_pCvarNemesisFreeze = register_cvar("ze_nemesis_freeze", "0")  // Nemesis get frozen? - 1 = doesn't get frozen | 0 = gets frozen
  126.     g_pCvarNemesisFire = register_cvar("ze_nemesis_fire", "1")  // Nemesis set on fire? - 1 = doesn't set on fire | 0 = set on fire
  127. }
  128.  
  129. public plugin_cfg()
  130. {
  131.     g_pCvarFreezetime = get_cvar_pointer("ze_freeze_time")
  132. }
  133.  
  134. public client_disconnected(id)
  135. {
  136.     UnSet_Nemesis(id)
  137. }
  138.  
  139. public client_putinserver(id)
  140. {
  141.     UnSet_Nemesis(id)
  142. }
  143.  
  144. public ze_user_infected_pre(iVictim, iAttacker)
  145. {
  146.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
  147.     {
  148.         ExecuteHamB(Ham_Killed, iVictim, iAttacker, 0)
  149.         return 1
  150.     }
  151.  
  152.     return 0
  153. }
  154.  
  155. public ze_fire_pre(id)
  156. {
  157.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFire))
  158.         return PLUGIN_HANDLED
  159.     return PLUGIN_CONTINUE
  160. }
  161.  
  162. public ze_frost_pre(id)
  163. {
  164.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFreeze))
  165.         return PLUGIN_HANDLED
  166.     return PLUGIN_CONTINUE
  167. }
  168.  
  169. public ze_user_humanized(id)
  170. {
  171.     UnSet_Nemesis(id)
  172. }
  173.  
  174. public ze_roundend()
  175. {
  176.     for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  177.     {
  178.         if (is_user_alive(id) && g_bIsNemesis[id])
  179.             UnSet_Nemesis(id)
  180.     }
  181. }
  182.  
  183. public ze_game_started_pre()
  184. {
  185.     while (g_bIsNextRoundNemesis)
  186.     {
  187.         g_bIsNextRoundNemesis = false
  188.         ze_colored_print(0, "!tThis is nemesis round.")
  189.         set_task(get_pcvar_float(g_pCvarFreezetime), "ChooseNemesis", TASK_MAKE_HEROINE)
  190.         return PLUGIN_HANDLED
  191.     }
  192.  
  193.     return PLUGIN_CONTINUE
  194. }
  195.  
  196. public ChooseNemesis(taskid)
  197. {
  198.     new id = GetRandomNemesis()
  199.     Set_Nemesis(id)
  200.     remove_task(taskid)
  201.     return
  202. }
  203.  
  204. public cmd_nemesis(id, level, cid)
  205. {
  206.     if (!cmd_access(id, STARTNEMESIS_ACCESS, cid, 0))
  207.     {
  208.         client_print(id, print_console, "You have not access.")
  209.         return PLUGIN_HANDLED
  210.     }
  211.    
  212.     g_bIsNextRoundNemesis = true
  213.     client_print(id, print_console, "Nemesis round will start next round.")
  214.  
  215.     new szName[32]
  216.     get_user_name(id, szName, charsmax(szName))
  217.     ze_colored_print(0, "!g%s !thas activated a nemesis round. Next round is nemesis.", szName)
  218.     return PLUGIN_HANDLED
  219. }
  220.  
  221. public Set_Nemesis(id)
  222. {
  223.     if (g_bIsNemesis[id] || !is_user_alive(id))
  224.         return
  225.  
  226.     g_bIsNemesis[id] = true
  227.  
  228.     if (!ze_is_user_zombie(id))
  229.         ze_set_user_zombie(id)
  230.  
  231.     #if defined USE_NEMESIS_LEAP
  232.         ze_get_longjump(id)
  233.     #endif
  234.  
  235.     #if defined USE_NEMESIS_MODEL
  236.         new szPlayerModel[32], szModel[64]
  237.         ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
  238.         cs_set_user_model(id, szPlayerModel)
  239.  
  240.         ArrayGetString(g_aModels_Nemesis_Claws, random_num(0, ArraySize(g_aModels_Nemesis_Claws) - 1), szModel, charsmax(szModel))
  241.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  242.     #endif
  243.    
  244.     if (get_pcvar_float(g_pCvarNemesisHP))
  245.     {
  246.         set_entvar(id, var_health, get_pcvar_float(g_pCvarNemesisHP))
  247.     }
  248.  
  249.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  250.     {
  251.         ze_set_zombie_speed(id, get_pcvar_num(g_pCvarNemesisSpeed))
  252.     }
  253.  
  254.     if (get_pcvar_num(g_pCvarNemesisGravity))
  255.     {
  256.         ze_set_user_gravity(id, get_pcvar_num(g_pCvarNemesisGravity))
  257.     }
  258.  
  259.     if (get_pcvar_num(g_pCvarNemesisKB))
  260.     {
  261.         ze_set_user_knockback(id, get_pcvar_float(g_pCvarNemesisKB))
  262.     }
  263.  
  264.     if (get_pcvar_num(g_pCvarNemesisGlow))
  265.     {
  266.         Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
  267.     }
  268.  
  269.     new szName[32]
  270.     get_user_name(id, szName, charsmax(szName))
  271.     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5)
  272.     show_hudmessage(id, "%s became Nemesis", szName)
  273.     ze_colored_print(0, "!g%s !tbecame !gNemesis!n.", szName)
  274.     ze_colored_print(id, "!gYou !tbecame !gNemesis!n.")
  275. }
  276.  
  277. public UnSet_Nemesis(id)
  278. {
  279.     if (!g_bIsNemesis[id] || !is_user_alive(id))
  280.         return
  281.  
  282.     g_bIsNemesis[id] = false
  283.  
  284.     #if defined USE_NEMESIS_LEAP
  285.         ze_remove_longjump(id)
  286.     #endif
  287.  
  288.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  289.     {
  290.         ze_reset_zombie_speed(id)
  291.     }
  292.  
  293.     if (get_pcvar_num(g_pCvarNemesisGravity))
  294.     {
  295.         ze_reset_user_gravity(id)
  296.     }
  297.  
  298.     if (get_pcvar_num(g_pCvarNemesisKB))
  299.     {
  300.         ze_reset_user_knockback(id)
  301.     }
  302.  
  303.     if (get_pcvar_num(g_pCvarNemesisGlow))
  304.     {
  305.         Set_Rendering(id)
  306.     }
  307. }
  308.  
  309. public GetRandomNemesis()
  310. {
  311.     new iPlayers[32], iSelected[33], iCount = 0, iTotalPlayers, iRandomIndex
  312.     get_players(iPlayers, iTotalPlayers)
  313.  
  314.     if (iTotalPlayers > 0)
  315.     {
  316.         for (new i = 0; i < iTotalPlayers; i++)
  317.         {
  318.             iRandomIndex = iPlayers[i]
  319.  
  320.             if (is_user_alive(iRandomIndex))
  321.             {
  322.                 iSelected[iCount++] = iRandomIndex
  323.             }
  324.         }
  325.  
  326.         return iSelected[random(--iCount)]
  327.     }
  328.  
  329.     return 0
  330. }
  331.  
  332. public native_ze_is_user_nemesis(id)
  333. {
  334.     if (!is_user_connected(id))
  335.     {
  336.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  337.         return -1
  338.     }
  339.  
  340.     return g_bIsNemesis[id]
  341. }
  342.  
  343. public native_ze_set_user_nemesis(id, bool:set)
  344. {
  345.     if (!is_user_connected(id))
  346.     {
  347.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  348.         return false
  349.     }
  350.  
  351.     if (set)
  352.     {
  353.         if (!g_bIsNemesis[id])
  354.             Set_Nemesis(id)
  355.     }
  356.     else
  357.     {
  358.         if (g_bIsNemesis[id])
  359.             UnSet_Nemesis(id)
  360.     }
  361.  
  362.     return true
  363. }
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 399
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#5

Post by Muhammet20 » 1 Month Ago

lizoumapper wrote:
1 Month Ago
Muhammet20 wrote:
1 Month Ago
i will creare one soon and it will work
You can fix it
this plugin is good :)
why you want create other one
try fix it
okay i will fix it no need to create another

[ Post made via Android ]
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

User avatar
lizoumapper
Senior Member
Senior Member
Morocco
Posts: 150
Joined: 9 Months Ago
Location: Morocco
Has thanked: 3 times
Been thanked: 7 times
Age: 17
Contact:

#6

Post by lizoumapper » 1 Month Ago

Code: Select all

AMX Mod X Compiler 1.9.0.5249
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Error: Number of arguments does not match definition on line 217

1 Error.
Could not locate output file C:\Users\loulou\Desktop\ze_class_nemesis.amx (compile failed).
I Love Learn Languages Programmations

User avatar
lizoumapper
Senior Member
Senior Member
Morocco
Posts: 150
Joined: 9 Months Ago
Location: Morocco
Has thanked: 3 times
Been thanked: 7 times
Age: 17
Contact:

#7

Post by lizoumapper » 1 Month Ago

Mohamed Alaa wrote:
1 Month Ago
I wrote the nemesis class with all features.

Note1: The code is not tested. So if anyone's willing to test, report please with ALL ERRORS & FULL DEBUG INFORMATION if found.
Note2: You have to use the leap code that you provided in the topic.
Note3: To start a nemesis round, say in console ze_start_nemesis_next and the round after the current will be nemesis round.
Note4: Configure cvars & defines.
  1. #include <zombie_escape>
  2.  
  3. // Uncomment to use custom model for nemesis
  4. // Note: This includes player model & claws
  5. //#define USE_NEMESIS_MODEL
  6.  
  7. // Uncomment to use leap for nemesis
  8. //#define USE_NEMESIS_LEAP
  9.  
  10. #define TASK_MAKE_HEROINE 4949849
  11.  
  12. // Access to start nemesis round
  13. #define STARTNEMESIS_ACCESS ADMIN_LEVEL_H
  14.  
  15. #if defined USE_NEMESIS_MODEL
  16. // Settings file
  17. new const ZE_SETTING_FILE[] = "zombie_escape.ini"
  18.  
  19. // Default models
  20. new const g_szModels_Nemesis_Player[][] = { "ze_nemesis_host" }
  21. new const g_szModels_Nemesis_Claws[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
  22.  
  23. new Array:g_aModels_Nemesis_Player,
  24.     Array:g_aModels_Nemesis_Claws
  25. #endif
  26.  
  27. #if defined USE_NEMESIS_LEAP
  28. native ze_get_longjump(id)
  29. native ze_remove_longjump(id)
  30. #endif
  31.  
  32. enum _:Colors
  33. {
  34.     Red = 0,
  35.     Green,
  36.     Blue
  37. }
  38.  
  39. new bool:g_bIsNemesis[33],
  40.     bool:g_bIsNextRoundNemesis = false
  41.  
  42. new g_pCvarNemesisHP,
  43.     g_pCvarNemesisGravity,
  44.     g_pCvarNemesisSpeed,
  45.     g_pCvarNemesisGlow,
  46.     g_pCvarNemesisGlowColor[Colors],
  47.     g_pCvarNemesisKB,
  48.     g_pCvarNemesisDmg,
  49.     g_pCvarNemesisFreeze,
  50.     g_pCvarNemesisFire
  51.  
  52. public plugin_natives()
  53. {
  54.     register_native("ze_is_user_nemesis", "native_ze_is_user_nemesis", 1)
  55.     register_native("ze_set_user_nemesis", "native_ze_set_user_nemesis", 1)
  56. }
  57.  
  58. #if defined USE_NEMESIS_MODEL
  59. public plugin_precache()
  60. {
  61.     // Initialize arrays
  62.     g_aModels_Nemesis_Player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  63.     g_aModels_Nemesis_Claws = ArrayCreate(MODEL_MAX_LENGTH, 1)
  64.    
  65.     // Load from external file
  66.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS MODEL", g_aModels_Nemesis_Player)
  67.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  68.    
  69.     // If we couldn't load from file, use and save default ones
  70.     new index
  71.  
  72.     if (ArraySize(g_aModels_Nemesis_Player) == 0)
  73.     {
  74.         for (index = 0; index < sizeof g_szModels_Nemesis_Player; index++)
  75.             ArrayPushString(g_aModels_Nemesis_Player, g_szModels_Nemesis_Player[index])
  76.        
  77.         // Save to external file
  78.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_aModels_Nemesis_Player)
  79.     }
  80.  
  81.     if (ArraySize(g_aModels_Nemesis_Claws) == 0)
  82.     {
  83.         for (index = 0; index < sizeof g_szModels_Nemesis_Claws; index++)
  84.             ArrayPushString(g_aModels_Nemesis_Claws, g_szModels_Nemesis_Claws[index])
  85.        
  86.         // Save to external file
  87.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  88.     }
  89.    
  90.     // Precache models
  91.     new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
  92.  
  93.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Player); index++)
  94.     {
  95.         ArrayGetString(g_aModels_Nemesis_Player, index, player_model, charsmax(player_model))
  96.         formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
  97.         precache_model(model_path)
  98.         // Support modelT.mdl files
  99.         formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
  100.         if (file_exists(model_path)) precache_model(model_path)
  101.     }
  102.  
  103.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Claws); index++)
  104.     {
  105.         ArrayGetString(g_aModels_Nemesis_Claws, index, model, charsmax(model))
  106.         precache_model(model)
  107.     }
  108. }
  109. #endif
  110.  
  111. public plugin_init()
  112. {
  113.     register_plugin("[ZE] Addons: Nemesis", "1.0", "Jack")
  114.  
  115.     RegisterHam(Ham_TakeDamage, "player", "Fw_TakeDamage")
  116.  
  117.     register_clcmd("ze_start_nemesis_next", "cmd_nemesis", STARTNEMESIS_ACCESS)
  118.  
  119.     g_pCvarNemesisHP = register_cvar("ze_nemesis_hp", "20000")  // Nemesis health - Set 0 to use zombie HP
  120.     g_pCvarNemesisGravity = register_cvar("ze_nemesis_gravity", "600")  // Nemesis gravity - Set 0 to use zombie gravity
  121.     g_pCvarNemesisSpeed = register_cvar("ze_nemesis_speed", "300")  // Nemesis speed - Set 0 to use zombie speed
  122.     g_pCvarNemesisGlow = register_cvar("ze_nemesis_glow", "1")  // Nemesis glow - 1 = enable | 0 = disable
  123.     g_pCvarNemesisGlowColor[Red] = register_cvar("ze_nemesis_glow_r", "255")    // Nemesis glow color RED
  124.     g_pCvarNemesisGlowColor[Green] = register_cvar("ze_nemesis_glow_g", "255")  // Nemesis glow color GREEN
  125.     g_pCvarNemesisGlowColor[Blue] = register_cvar("ze_nemesis_glow_b", "255")   // Nemesis glow color BLUE
  126.     g_pCvarNemesisKB = register_cvar("ze_nemesis_kb", "200.0")  // Nemesis knockback - Set 0 to use zombie knockback
  127.     g_pCvarNemesisDmg = register_cvar("ze_nemesis_dmg", "200.0")    // Nemesis damage
  128.     g_pCvarNemesisFreeze = register_cvar("ze_nemesis_freeze", "0")  // Nemesis get frozen? - 1 = doesn't get frozen | 0 = gets frozen
  129.     g_pCvarNemesisFire = register_cvar("ze_nemesis_fire", "1")  // Nemesis set on fire? - 1 = doesn't set on fire | 0 = set on fire
  130. }
  131.  
  132. public client_disconnected(id)
  133. {
  134.     g_bIsNemesis[id] = false
  135. }
  136.  
  137. public client_putinserver(id)
  138. {
  139.     g_bIsNemesis[id] = false
  140. }
  141.  
  142. public ze_user_infected_pre(iVictim, iAttacker)
  143. {
  144.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
  145.     {
  146.         SendDeathMsg(iAttacker, iVictim)
  147.         return 1
  148.     }
  149.  
  150.     return 0
  151. }
  152.  
  153. public Fw_TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage)
  154. {
  155.     if (iVictim == iAttacker || !is_user_alive(iAttacker))
  156.         return HAM_IGNORED
  157.  
  158.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim) && iInfector == iAttacker)
  159.     {
  160.         SetHamParamFloat(4, iDamage * get_pcvar_float(g_pCvarNemesisDmg))
  161.         return HAM_HANDLED
  162.     }
  163.  
  164.     return HAM_IGNORED
  165. }
  166.  
  167. public ze_fire_pre(id)
  168. {
  169.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFire))
  170.         return PLUGIN_HANDLED
  171.     return PLUGIN_CONTINUE
  172. }
  173.  
  174. public ze_frost_pre(id)
  175. {
  176.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFreeze))
  177.         return PLUGIN_HANDLED
  178.     return PLUGIN_CONTINUE
  179. }
  180.  
  181. public ze_user_humanized(id)
  182. {
  183.     UnSet_Nemesis(id)
  184. }
  185.  
  186. public ze_roundend()
  187. {
  188.     for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  189.     {
  190.         if (is_user_alive(id) && g_bIsNemesis[id])
  191.             UnSet_Nemesis(id)
  192.     }
  193. }
  194.  
  195. public ze_game_started_pre()
  196. {
  197.     while (g_bIsNextRoundNemesis)
  198.     {
  199.         g_bIsNextRoundNemesis = false
  200.         set_task(3.0, "ChooseNemesis", TASK_MAKE_HEROINE)
  201.         return PLUGIN_HANDLED
  202.     }
  203.  
  204.     return PLUGIN_CONTINUE
  205. }
  206.  
  207. public ChooseNemesis(taskid)
  208. {
  209.     new id = GetRandomNemesis()
  210.     Set_Nemesis(id)
  211.     remove_task(taskid)
  212.     return
  213. }
  214.  
  215. public cmd_zombie(id, level, cid)
  216. {
  217.     if (!cmd_access(id, STARTNEMESIS_ACCESS, cid))
  218.     {
  219.         client_print(id, print_console, "You have not access.")
  220.         return PLUGIN_HANDLED
  221.     }
  222.    
  223.     g_bIsNextRoundNemesis = true
  224.     client_print(id, print_console, "Nemesis round will start next round.")
  225.     return PLUGIN_HANDLED
  226. }
  227.  
  228. public Set_Nemesis(id)
  229. {
  230.     if (g_bIsNemesis[id] || !is_user_alive(id))
  231.         return
  232.  
  233.     g_bIsNemesis[id] = true
  234.  
  235.     if (!ze_is_user_zombie(id))
  236.         ze_set_user_zombie(id)
  237.  
  238.     #if defined USE_NEMESIS_LEAP
  239.         ze_get_longjump(id)
  240.     #endif
  241.  
  242.     #if defined USE_NEMESIS_MODEL
  243.         new szPlayerModel[32], szModel[64]
  244.         ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
  245.         cs_set_user_model(id, szPlayerModel)
  246.  
  247.         ArrayGetString(g_aModels_Nemesis_Claws, random_num(0, ArraySize(g_aModels_Nemesis_Claws) - 1), szModel, charsmax(szModel))
  248.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  249.     #endif
  250.    
  251.     if (get_pcvar_float(g_pCvarNemesisHP))
  252.     {
  253.         set_entvar(id, var_health, get_pcvar_float(g_pCvarNemesisHP))
  254.     }
  255.  
  256.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  257.     {
  258.         ze_set_zombie_speed(id, get_pcvar_num(g_pCvarNemesisSpeed))
  259.     }
  260.  
  261.     if (get_pcvar_num(g_pCvarNemesisGravity))
  262.     {
  263.         ze_set_user_gravity(id, get_pcvar_num(g_pCvarNemesisGravity))
  264.     }
  265.  
  266.     if (get_pcvar_num(g_pCvarNemesisKB))
  267.     {
  268.         ze_set_user_knockback(id, get_pcvar_num(g_pCvarNemesisKB))
  269.     }
  270.  
  271.     if (get_pcvar_num(g_pCvarNemesisGlow))
  272.     {
  273.         Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
  274.     }
  275.  
  276.     new szName[32]
  277.     get_user_name(id, szName, charsmax(szName))
  278.     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5)
  279.     show_hudmessage(id, "%s became Nemesis", szName)
  280.     ze_colored_print(0, "!g%s !tbecame !gNemesis!n.", szName)
  281.     ze_colored_print(id, "!gYou !tbecame !gNemesis!n.")
  282. }
  283.  
  284. public UnSet_Nemesis(id)
  285. {
  286.     if (!g_bIsNemesis[id] || !is_user_alive(id))
  287.         return
  288.  
  289.     g_bIsNemesis[id] = false
  290.  
  291.     #if defined USE_NEMESIS_LEAP
  292.         ze_remove_longjump(id)
  293.     #endif
  294.  
  295.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  296.     {
  297.         ze_reset_zombie_speed(id)
  298.     }
  299.  
  300.     if (get_pcvar_num(g_pCvarNemesisGravity))
  301.     {
  302.         ze_reset_user_gravity(id)
  303.     }
  304.  
  305.     if (get_pcvar_num(g_pCvarNemesisKB))
  306.     {
  307.         ze_reset_user_knockback(id)
  308.     }
  309.  
  310.     if (get_pcvar_num(g_pCvarNemesisGlow))
  311.     {
  312.         Set_Rendering(id)
  313.     }
  314. }
  315.  
  316. public GetRandomNemesis()
  317. {
  318.     new iPlayers[32], iSelected[33], iCount = 0, iTotalPlayers, iRandomIndex
  319.     get_players(iPlayers, iTotalPlayers)
  320.  
  321.     if (iTotalPlayers > 0)
  322.     {
  323.         for (new i = 0; i < iTotalPlayers; i++)
  324.         {
  325.             iRandomIndex = iPlayers[i]
  326.  
  327.             if (is_user_alive(iRandomIndex))
  328.             {
  329.                 iSelected[iCount++] = iRandomIndex
  330.             }
  331.         }
  332.  
  333.         return iSelected[random(--iCount)]
  334.     }
  335.  
  336.     return 0
  337. }
  338.  
  339. public native_ze_is_user_nemesis(id)
  340. {
  341.     if (!is_user_connected(id))
  342.     {
  343.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  344.         return -1
  345.     }
  346.  
  347.     return g_bIsNemesis[id]
  348. }
  349.  
  350. public native_ze_set_user_nemesis(id, bool:set)
  351. {
  352.     if (!is_user_connected(id))
  353.     {
  354.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  355.         return false
  356.     }
  357.  
  358.     if (set)
  359.     {
  360.         if (!g_bIsNemesis[id])
  361.             Set_Nemesis(id)
  362.     }
  363.     else
  364.     {
  365.         if (g_bIsNemesis[id])
  366.             UnSet_Nemesis(id)
  367.     }
  368.  
  369.     return true
  370. }
Not Work + Reason Crash server
I Love Learn Languages Programmations

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 622
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#8

Post by Mohamed Alaa » 1 Month Ago

lizoumapper wrote:
1 Month Ago
Not Work + Reason Crash server
Try:
  1. #include <zombie_escape>
  2.  
  3. // Uncomment to use custom model for nemesis
  4. // Note: This includes player model & claws
  5. //#define USE_NEMESIS_MODEL
  6.  
  7. // Uncomment to use leap for nemesis
  8. //#define USE_NEMESIS_LEAP
  9.  
  10. #define TASK_MAKE_HEROINE 4949849
  11.  
  12. // Access to start nemesis round
  13. #define STARTNEMESIS_ACCESS ADMIN_LEVEL_H
  14.  
  15. #if defined USE_NEMESIS_MODEL
  16. // Settings file
  17. new const ZE_SETTING_FILE[] = "zombie_escape.ini"
  18.  
  19. // Default models
  20. new const g_szModels_Nemesis_Player[][] = { "ze_nemesis_host" }
  21. new const g_szModels_Nemesis_Claws[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
  22.  
  23. new Array:g_aModels_Nemesis_Player,
  24.     Array:g_aModels_Nemesis_Claws
  25. #endif
  26.  
  27. #if defined USE_NEMESIS_LEAP
  28. native ze_get_longjump(id)
  29. native ze_remove_longjump(id)
  30. #endif
  31.  
  32. enum _:Colors
  33. {
  34.     Red = 0,
  35.     Green,
  36.     Blue
  37. }
  38.  
  39. new bool:g_bIsNemesis[33],
  40.     bool:g_bIsNextRoundNemesis = false
  41.  
  42. new g_pCvarNemesisHP,
  43.     g_pCvarNemesisGravity,
  44.     g_pCvarNemesisSpeed,
  45.     g_pCvarNemesisGlow,
  46.     g_pCvarNemesisGlowColor[Colors],
  47.     g_pCvarNemesisKB,
  48.     g_pCvarNemesisDmg,
  49.     g_pCvarNemesisFreeze,
  50.     g_pCvarNemesisFire
  51.  
  52. public plugin_natives()
  53. {
  54.     register_native("ze_is_user_nemesis", "native_ze_is_user_nemesis", 1)
  55.     register_native("ze_set_user_nemesis", "native_ze_set_user_nemesis", 1)
  56. }
  57.  
  58. #if defined USE_NEMESIS_MODEL
  59. public plugin_precache()
  60. {
  61.     // Initialize arrays
  62.     g_aModels_Nemesis_Player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  63.     g_aModels_Nemesis_Claws = ArrayCreate(MODEL_MAX_LENGTH, 1)
  64.    
  65.     // Load from external file
  66.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS MODEL", g_aModels_Nemesis_Player)
  67.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  68.    
  69.     // If we couldn't load from file, use and save default ones
  70.     new index
  71.  
  72.     if (ArraySize(g_aModels_Nemesis_Player) == 0)
  73.     {
  74.         for (index = 0; index < sizeof g_szModels_Nemesis_Player; index++)
  75.             ArrayPushString(g_aModels_Nemesis_Player, g_szModels_Nemesis_Player[index])
  76.        
  77.         // Save to external file
  78.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_aModels_Nemesis_Player)
  79.     }
  80.  
  81.     if (ArraySize(g_aModels_Nemesis_Claws) == 0)
  82.     {
  83.         for (index = 0; index < sizeof g_szModels_Nemesis_Claws; index++)
  84.             ArrayPushString(g_aModels_Nemesis_Claws, g_szModels_Nemesis_Claws[index])
  85.        
  86.         // Save to external file
  87.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  88.     }
  89.    
  90.     // Precache models
  91.     new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
  92.  
  93.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Player); index++)
  94.     {
  95.         ArrayGetString(g_aModels_Nemesis_Player, index, player_model, charsmax(player_model))
  96.         formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
  97.         precache_model(model_path)
  98.         // Support modelT.mdl files
  99.         formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
  100.         if (file_exists(model_path)) precache_model(model_path)
  101.     }
  102.  
  103.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Claws); index++)
  104.     {
  105.         ArrayGetString(g_aModels_Nemesis_Claws, index, model, charsmax(model))
  106.         precache_model(model)
  107.     }
  108. }
  109. #endif
  110.  
  111. public plugin_init()
  112. {
  113.     register_plugin("[ZE] Addons: Nemesis", "1.0", "Jack")
  114.  
  115.     RegisterHam(Ham_TakeDamage, "player", "Fw_TakeDamage")
  116.  
  117.     register_clcmd("ze_start_nemesis_next", "cmd_nemesis", STARTNEMESIS_ACCESS)
  118.  
  119.     g_pCvarNemesisHP = register_cvar("ze_nemesis_hp", "20000")  // Nemesis health - Set 0 to use zombie HP
  120.     g_pCvarNemesisGravity = register_cvar("ze_nemesis_gravity", "600")  // Nemesis gravity - Set 0 to use zombie gravity
  121.     g_pCvarNemesisSpeed = register_cvar("ze_nemesis_speed", "300")  // Nemesis speed - Set 0 to use zombie speed
  122.     g_pCvarNemesisGlow = register_cvar("ze_nemesis_glow", "1")  // Nemesis glow - 1 = enable | 0 = disable
  123.     g_pCvarNemesisGlowColor[Red] = register_cvar("ze_nemesis_glow_r", "255")    // Nemesis glow color RED
  124.     g_pCvarNemesisGlowColor[Green] = register_cvar("ze_nemesis_glow_g", "255")  // Nemesis glow color GREEN
  125.     g_pCvarNemesisGlowColor[Blue] = register_cvar("ze_nemesis_glow_b", "255")   // Nemesis glow color BLUE
  126.     g_pCvarNemesisKB = register_cvar("ze_nemesis_kb", "200.0")  // Nemesis knockback - Set 0 to use zombie knockback
  127.     g_pCvarNemesisDmg = register_cvar("ze_nemesis_dmg", "200.0")    // Nemesis damage
  128.     g_pCvarNemesisFreeze = register_cvar("ze_nemesis_freeze", "0")  // Nemesis get frozen? - 1 = doesn't get frozen | 0 = gets frozen
  129.     g_pCvarNemesisFire = register_cvar("ze_nemesis_fire", "1")  // Nemesis set on fire? - 1 = doesn't set on fire | 0 = set on fire
  130. }
  131.  
  132. public client_disconnected(id)
  133. {
  134.     g_bIsNemesis[id] = false
  135. }
  136.  
  137. public client_putinserver(id)
  138. {
  139.     g_bIsNemesis[id] = false
  140. }
  141.  
  142. public ze_user_infected_pre(iVictim, iAttacker)
  143. {
  144.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
  145.     {
  146.         SendDeathMsg(iAttacker, iVictim)
  147.         return 1
  148.     }
  149.  
  150.     return 0
  151. }
  152.  
  153. public Fw_TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage)
  154. {
  155.     if (iVictim == iAttacker || !is_user_alive(iAttacker))
  156.         return HAM_IGNORED
  157.  
  158.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim) && iInfector == iAttacker)
  159.     {
  160.         SetHamParamFloat(4, iDamage * get_pcvar_float(g_pCvarNemesisDmg))
  161.         return HAM_HANDLED
  162.     }
  163.  
  164.     return HAM_IGNORED
  165. }
  166.  
  167. public ze_fire_pre(id)
  168. {
  169.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFire))
  170.         return PLUGIN_HANDLED
  171.     return PLUGIN_CONTINUE
  172. }
  173.  
  174. public ze_frost_pre(id)
  175. {
  176.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFreeze))
  177.         return PLUGIN_HANDLED
  178.     return PLUGIN_CONTINUE
  179. }
  180.  
  181. public ze_user_humanized(id)
  182. {
  183.     UnSet_Nemesis(id)
  184. }
  185.  
  186. public ze_roundend()
  187. {
  188.     for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  189.     {
  190.         if (is_user_alive(id) && g_bIsNemesis[id])
  191.             UnSet_Nemesis(id)
  192.     }
  193. }
  194.  
  195. public ze_game_started_pre()
  196. {
  197.     while (g_bIsNextRoundNemesis)
  198.     {
  199.         g_bIsNextRoundNemesis = false
  200.         set_task(3.0, "ChooseNemesis", TASK_MAKE_HEROINE)
  201.         return PLUGIN_HANDLED
  202.     }
  203.  
  204.     return PLUGIN_CONTINUE
  205. }
  206.  
  207. public ChooseNemesis(taskid)
  208. {
  209.     new id = GetRandomNemesis()
  210.     Set_Nemesis(id)
  211.     remove_task(taskid)
  212.     return
  213. }
  214.  
  215. public cmd_zombie(id, level, cid)
  216. {
  217.     if (!cmd_access(id, STARTNEMESIS_ACCESS, cid, 0))
  218.     {
  219.         client_print(id, print_console, "You have not access.")
  220.         return PLUGIN_HANDLED
  221.     }
  222.    
  223.     g_bIsNextRoundNemesis = true
  224.     client_print(id, print_console, "Nemesis round will start next round.")
  225.     return PLUGIN_HANDLED
  226. }
  227.  
  228. public Set_Nemesis(id)
  229. {
  230.     if (g_bIsNemesis[id] || !is_user_alive(id))
  231.         return
  232.  
  233.     g_bIsNemesis[id] = true
  234.  
  235.     if (!ze_is_user_zombie(id))
  236.         ze_set_user_zombie(id)
  237.  
  238.     #if defined USE_NEMESIS_LEAP
  239.         ze_get_longjump(id)
  240.     #endif
  241.  
  242.     #if defined USE_NEMESIS_MODEL
  243.         new szPlayerModel[32], szModel[64]
  244.         ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
  245.         cs_set_user_model(id, szPlayerModel)
  246.  
  247.         ArrayGetString(g_aModels_Nemesis_Claws, random_num(0, ArraySize(g_aModels_Nemesis_Claws) - 1), szModel, charsmax(szModel))
  248.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  249.     #endif
  250.    
  251.     if (get_pcvar_float(g_pCvarNemesisHP))
  252.     {
  253.         set_entvar(id, var_health, get_pcvar_float(g_pCvarNemesisHP))
  254.     }
  255.  
  256.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  257.     {
  258.         ze_set_zombie_speed(id, get_pcvar_num(g_pCvarNemesisSpeed))
  259.     }
  260.  
  261.     if (get_pcvar_num(g_pCvarNemesisGravity))
  262.     {
  263.         ze_set_user_gravity(id, get_pcvar_num(g_pCvarNemesisGravity))
  264.     }
  265.  
  266.     if (get_pcvar_num(g_pCvarNemesisKB))
  267.     {
  268.         ze_set_user_knockback(id, get_pcvar_float(g_pCvarNemesisKB))
  269.     }
  270.  
  271.     if (get_pcvar_num(g_pCvarNemesisGlow))
  272.     {
  273.         Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
  274.     }
  275.  
  276.     new szName[32]
  277.     get_user_name(id, szName, charsmax(szName))
  278.     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5)
  279.     show_hudmessage(id, "%s became Nemesis", szName)
  280.     ze_colored_print(0, "!g%s !tbecame !gNemesis!n.", szName)
  281.     ze_colored_print(id, "!gYou !tbecame !gNemesis!n.")
  282. }
  283.  
  284. public UnSet_Nemesis(id)
  285. {
  286.     if (!g_bIsNemesis[id] || !is_user_alive(id))
  287.         return
  288.  
  289.     g_bIsNemesis[id] = false
  290.  
  291.     #if defined USE_NEMESIS_LEAP
  292.         ze_remove_longjump(id)
  293.     #endif
  294.  
  295.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  296.     {
  297.         ze_reset_zombie_speed(id)
  298.     }
  299.  
  300.     if (get_pcvar_num(g_pCvarNemesisGravity))
  301.     {
  302.         ze_reset_user_gravity(id)
  303.     }
  304.  
  305.     if (get_pcvar_num(g_pCvarNemesisKB))
  306.     {
  307.         ze_reset_user_knockback(id)
  308.     }
  309.  
  310.     if (get_pcvar_num(g_pCvarNemesisGlow))
  311.     {
  312.         Set_Rendering(id)
  313.     }
  314. }
  315.  
  316. public GetRandomNemesis()
  317. {
  318.     new iPlayers[32], iSelected[33], iCount = 0, iTotalPlayers, iRandomIndex
  319.     get_players(iPlayers, iTotalPlayers)
  320.  
  321.     if (iTotalPlayers > 0)
  322.     {
  323.         for (new i = 0; i < iTotalPlayers; i++)
  324.         {
  325.             iRandomIndex = iPlayers[i]
  326.  
  327.             if (is_user_alive(iRandomIndex))
  328.             {
  329.                 iSelected[iCount++] = iRandomIndex
  330.             }
  331.         }
  332.  
  333.         return iSelected[random(--iCount)]
  334.     }
  335.  
  336.     return 0
  337. }
  338.  
  339. public native_ze_is_user_nemesis(id)
  340. {
  341.     if (!is_user_connected(id))
  342.     {
  343.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  344.         return -1
  345.     }
  346.  
  347.     return g_bIsNemesis[id]
  348. }
  349.  
  350. public native_ze_set_user_nemesis(id, bool:set)
  351. {
  352.     if (!is_user_connected(id))
  353.     {
  354.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  355.         return false
  356.     }
  357.  
  358.     if (set)
  359.     {
  360.         if (!g_bIsNemesis[id])
  361.             Set_Nemesis(id)
  362.     }
  363.     else
  364.     {
  365.         if (g_bIsNemesis[id])
  366.             UnSet_Nemesis(id)
  367.     }
  368.  
  369.     return true
  370. }
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

User avatar
lizoumapper
Senior Member
Senior Member
Morocco
Posts: 150
Joined: 9 Months Ago
Location: Morocco
Has thanked: 3 times
Been thanked: 7 times
Age: 17
Contact:

#9

Post by lizoumapper » 1 Month Ago

Mohamed Alaa wrote:
1 Month Ago
lizoumapper wrote:
1 Month Ago
Not Work + Reason Crash server
Try:
  1. #include <zombie_escape>
  2.  
  3. // Uncomment to use custom model for nemesis
  4. // Note: This includes player model & claws
  5. //#define USE_NEMESIS_MODEL
  6.  
  7. // Uncomment to use leap for nemesis
  8. //#define USE_NEMESIS_LEAP
  9.  
  10. #define TASK_MAKE_HEROINE 4949849
  11.  
  12. // Access to start nemesis round
  13. #define STARTNEMESIS_ACCESS ADMIN_LEVEL_H
  14.  
  15. #if defined USE_NEMESIS_MODEL
  16. // Settings file
  17. new const ZE_SETTING_FILE[] = "zombie_escape.ini"
  18.  
  19. // Default models
  20. new const g_szModels_Nemesis_Player[][] = { "ze_nemesis_host" }
  21. new const g_szModels_Nemesis_Claws[][] = { "models/zombie_escape/v_knife_nemesis.mdl" }
  22.  
  23. new Array:g_aModels_Nemesis_Player,
  24.     Array:g_aModels_Nemesis_Claws
  25. #endif
  26.  
  27. #if defined USE_NEMESIS_LEAP
  28. native ze_get_longjump(id)
  29. native ze_remove_longjump(id)
  30. #endif
  31.  
  32. enum _:Colors
  33. {
  34.     Red = 0,
  35.     Green,
  36.     Blue
  37. }
  38.  
  39. new bool:g_bIsNemesis[33],
  40.     bool:g_bIsNextRoundNemesis = false
  41.  
  42. new g_pCvarNemesisHP,
  43.     g_pCvarNemesisGravity,
  44.     g_pCvarNemesisSpeed,
  45.     g_pCvarNemesisGlow,
  46.     g_pCvarNemesisGlowColor[Colors],
  47.     g_pCvarNemesisKB,
  48.     g_pCvarNemesisDmg,
  49.     g_pCvarNemesisFreeze,
  50.     g_pCvarNemesisFire
  51.  
  52. public plugin_natives()
  53. {
  54.     register_native("ze_is_user_nemesis", "native_ze_is_user_nemesis", 1)
  55.     register_native("ze_set_user_nemesis", "native_ze_set_user_nemesis", 1)
  56. }
  57.  
  58. #if defined USE_NEMESIS_MODEL
  59. public plugin_precache()
  60. {
  61.     // Initialize arrays
  62.     g_aModels_Nemesis_Player = ArrayCreate(PLAYERMODEL_MAX_LENGTH, 1)
  63.     g_aModels_Nemesis_Claws = ArrayCreate(MODEL_MAX_LENGTH, 1)
  64.    
  65.     // Load from external file
  66.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS MODEL", g_aModels_Nemesis_Player)
  67.     amx_load_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  68.    
  69.     // If we couldn't load from file, use and save default ones
  70.     new index
  71.  
  72.     if (ArraySize(g_aModels_Nemesis_Player) == 0)
  73.     {
  74.         for (index = 0; index < sizeof g_szModels_Nemesis_Player; index++)
  75.             ArrayPushString(g_aModels_Nemesis_Player, g_szModels_Nemesis_Player[index])
  76.        
  77.         // Save to external file
  78.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Player Models", "NEMESIS", g_aModels_Nemesis_Player)
  79.     }
  80.  
  81.     if (ArraySize(g_aModels_Nemesis_Claws) == 0)
  82.     {
  83.         for (index = 0; index < sizeof g_szModels_Nemesis_Claws; index++)
  84.             ArrayPushString(g_aModels_Nemesis_Claws, g_szModels_Nemesis_Claws[index])
  85.        
  86.         // Save to external file
  87.         amx_save_setting_string_arr(ZE_SETTING_FILE, "Weapon Models", "V_KNIFE NEMESIS", g_aModels_Nemesis_Claws)
  88.     }
  89.    
  90.     // Precache models
  91.     new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
  92.  
  93.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Player); index++)
  94.     {
  95.         ArrayGetString(g_aModels_Nemesis_Player, index, player_model, charsmax(player_model))
  96.         formatex(model_path, charsmax(model_path), "models/player/%s/%s.mdl", player_model, player_model)
  97.         precache_model(model_path)
  98.         // Support modelT.mdl files
  99.         formatex(model_path, charsmax(model_path), "models/player/%s/%sT.mdl", player_model, player_model)
  100.         if (file_exists(model_path)) precache_model(model_path)
  101.     }
  102.  
  103.     for (index = 0; index < ArraySize(g_aModels_Nemesis_Claws); index++)
  104.     {
  105.         ArrayGetString(g_aModels_Nemesis_Claws, index, model, charsmax(model))
  106.         precache_model(model)
  107.     }
  108. }
  109. #endif
  110.  
  111. public plugin_init()
  112. {
  113.     register_plugin("[ZE] Addons: Nemesis", "1.0", "Jack")
  114.  
  115.     RegisterHam(Ham_TakeDamage, "player", "Fw_TakeDamage")
  116.  
  117.     register_clcmd("ze_start_nemesis_next", "cmd_nemesis", STARTNEMESIS_ACCESS)
  118.  
  119.     g_pCvarNemesisHP = register_cvar("ze_nemesis_hp", "20000")  // Nemesis health - Set 0 to use zombie HP
  120.     g_pCvarNemesisGravity = register_cvar("ze_nemesis_gravity", "600")  // Nemesis gravity - Set 0 to use zombie gravity
  121.     g_pCvarNemesisSpeed = register_cvar("ze_nemesis_speed", "300")  // Nemesis speed - Set 0 to use zombie speed
  122.     g_pCvarNemesisGlow = register_cvar("ze_nemesis_glow", "1")  // Nemesis glow - 1 = enable | 0 = disable
  123.     g_pCvarNemesisGlowColor[Red] = register_cvar("ze_nemesis_glow_r", "255")    // Nemesis glow color RED
  124.     g_pCvarNemesisGlowColor[Green] = register_cvar("ze_nemesis_glow_g", "255")  // Nemesis glow color GREEN
  125.     g_pCvarNemesisGlowColor[Blue] = register_cvar("ze_nemesis_glow_b", "255")   // Nemesis glow color BLUE
  126.     g_pCvarNemesisKB = register_cvar("ze_nemesis_kb", "200.0")  // Nemesis knockback - Set 0 to use zombie knockback
  127.     g_pCvarNemesisDmg = register_cvar("ze_nemesis_dmg", "200.0")    // Nemesis damage
  128.     g_pCvarNemesisFreeze = register_cvar("ze_nemesis_freeze", "0")  // Nemesis get frozen? - 1 = doesn't get frozen | 0 = gets frozen
  129.     g_pCvarNemesisFire = register_cvar("ze_nemesis_fire", "1")  // Nemesis set on fire? - 1 = doesn't set on fire | 0 = set on fire
  130. }
  131.  
  132. public client_disconnected(id)
  133. {
  134.     g_bIsNemesis[id] = false
  135. }
  136.  
  137. public client_putinserver(id)
  138. {
  139.     g_bIsNemesis[id] = false
  140. }
  141.  
  142. public ze_user_infected_pre(iVictim, iAttacker)
  143. {
  144.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim))
  145.     {
  146.         SendDeathMsg(iAttacker, iVictim)
  147.         return 1
  148.     }
  149.  
  150.     return 0
  151. }
  152.  
  153. public Fw_TakeDamage(iVictim, iInfector, iAttacker, Float:iDamage)
  154. {
  155.     if (iVictim == iAttacker || !is_user_alive(iAttacker))
  156.         return HAM_IGNORED
  157.  
  158.     if (g_bIsNemesis[iAttacker] && !ze_is_user_zombie(iVictim) && iInfector == iAttacker)
  159.     {
  160.         SetHamParamFloat(4, iDamage * get_pcvar_float(g_pCvarNemesisDmg))
  161.         return HAM_HANDLED
  162.     }
  163.  
  164.     return HAM_IGNORED
  165. }
  166.  
  167. public ze_fire_pre(id)
  168. {
  169.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFire))
  170.         return PLUGIN_HANDLED
  171.     return PLUGIN_CONTINUE
  172. }
  173.  
  174. public ze_frost_pre(id)
  175. {
  176.     if (g_bIsNemesis[id] && get_pcvar_num(g_pCvarNemesisFreeze))
  177.         return PLUGIN_HANDLED
  178.     return PLUGIN_CONTINUE
  179. }
  180.  
  181. public ze_user_humanized(id)
  182. {
  183.     UnSet_Nemesis(id)
  184. }
  185.  
  186. public ze_roundend()
  187. {
  188.     for (new id = 0; id <= get_member_game(m_nMaxPlayers); id++)
  189.     {
  190.         if (is_user_alive(id) && g_bIsNemesis[id])
  191.             UnSet_Nemesis(id)
  192.     }
  193. }
  194.  
  195. public ze_game_started_pre()
  196. {
  197.     while (g_bIsNextRoundNemesis)
  198.     {
  199.         g_bIsNextRoundNemesis = false
  200.         set_task(3.0, "ChooseNemesis", TASK_MAKE_HEROINE)
  201.         return PLUGIN_HANDLED
  202.     }
  203.  
  204.     return PLUGIN_CONTINUE
  205. }
  206.  
  207. public ChooseNemesis(taskid)
  208. {
  209.     new id = GetRandomNemesis()
  210.     Set_Nemesis(id)
  211.     remove_task(taskid)
  212.     return
  213. }
  214.  
  215. public cmd_zombie(id, level, cid)
  216. {
  217.     if (!cmd_access(id, STARTNEMESIS_ACCESS, cid, 0))
  218.     {
  219.         client_print(id, print_console, "You have not access.")
  220.         return PLUGIN_HANDLED
  221.     }
  222.    
  223.     g_bIsNextRoundNemesis = true
  224.     client_print(id, print_console, "Nemesis round will start next round.")
  225.     return PLUGIN_HANDLED
  226. }
  227.  
  228. public Set_Nemesis(id)
  229. {
  230.     if (g_bIsNemesis[id] || !is_user_alive(id))
  231.         return
  232.  
  233.     g_bIsNemesis[id] = true
  234.  
  235.     if (!ze_is_user_zombie(id))
  236.         ze_set_user_zombie(id)
  237.  
  238.     #if defined USE_NEMESIS_LEAP
  239.         ze_get_longjump(id)
  240.     #endif
  241.  
  242.     #if defined USE_NEMESIS_MODEL
  243.         new szPlayerModel[32], szModel[64]
  244.         ArrayGetString(g_aModels_Nemesis_Player, random_num(0, ArraySize(g_aModels_Nemesis_Player) - 1), szPlayerModel, charsmax(szPlayerModel))
  245.         cs_set_user_model(id, szPlayerModel)
  246.  
  247.         ArrayGetString(g_aModels_Nemesis_Claws, random_num(0, ArraySize(g_aModels_Nemesis_Claws) - 1), szModel, charsmax(szModel))
  248.         cs_set_player_view_model(id, CSW_KNIFE, szModel)
  249.     #endif
  250.    
  251.     if (get_pcvar_float(g_pCvarNemesisHP))
  252.     {
  253.         set_entvar(id, var_health, get_pcvar_float(g_pCvarNemesisHP))
  254.     }
  255.  
  256.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  257.     {
  258.         ze_set_zombie_speed(id, get_pcvar_num(g_pCvarNemesisSpeed))
  259.     }
  260.  
  261.     if (get_pcvar_num(g_pCvarNemesisGravity))
  262.     {
  263.         ze_set_user_gravity(id, get_pcvar_num(g_pCvarNemesisGravity))
  264.     }
  265.  
  266.     if (get_pcvar_num(g_pCvarNemesisKB))
  267.     {
  268.         ze_set_user_knockback(id, get_pcvar_float(g_pCvarNemesisKB))
  269.     }
  270.  
  271.     if (get_pcvar_num(g_pCvarNemesisGlow))
  272.     {
  273.         Set_Rendering(id, kRenderFxNone, 255, 0, 0, kRenderNormal, 15)
  274.     }
  275.  
  276.     new szName[32]
  277.     get_user_name(id, szName, charsmax(szName))
  278.     set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 1.5)
  279.     show_hudmessage(id, "%s became Nemesis", szName)
  280.     ze_colored_print(0, "!g%s !tbecame !gNemesis!n.", szName)
  281.     ze_colored_print(id, "!gYou !tbecame !gNemesis!n.")
  282. }
  283.  
  284. public UnSet_Nemesis(id)
  285. {
  286.     if (!g_bIsNemesis[id] || !is_user_alive(id))
  287.         return
  288.  
  289.     g_bIsNemesis[id] = false
  290.  
  291.     #if defined USE_NEMESIS_LEAP
  292.         ze_remove_longjump(id)
  293.     #endif
  294.  
  295.     if (get_pcvar_num(g_pCvarNemesisSpeed))
  296.     {
  297.         ze_reset_zombie_speed(id)
  298.     }
  299.  
  300.     if (get_pcvar_num(g_pCvarNemesisGravity))
  301.     {
  302.         ze_reset_user_gravity(id)
  303.     }
  304.  
  305.     if (get_pcvar_num(g_pCvarNemesisKB))
  306.     {
  307.         ze_reset_user_knockback(id)
  308.     }
  309.  
  310.     if (get_pcvar_num(g_pCvarNemesisGlow))
  311.     {
  312.         Set_Rendering(id)
  313.     }
  314. }
  315.  
  316. public GetRandomNemesis()
  317. {
  318.     new iPlayers[32], iSelected[33], iCount = 0, iTotalPlayers, iRandomIndex
  319.     get_players(iPlayers, iTotalPlayers)
  320.  
  321.     if (iTotalPlayers > 0)
  322.     {
  323.         for (new i = 0; i < iTotalPlayers; i++)
  324.         {
  325.             iRandomIndex = iPlayers[i]
  326.  
  327.             if (is_user_alive(iRandomIndex))
  328.             {
  329.                 iSelected[iCount++] = iRandomIndex
  330.             }
  331.         }
  332.  
  333.         return iSelected[random(--iCount)]
  334.     }
  335.  
  336.     return 0
  337. }
  338.  
  339. public native_ze_is_user_nemesis(id)
  340. {
  341.     if (!is_user_connected(id))
  342.     {
  343.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  344.         return -1
  345.     }
  346.  
  347.     return g_bIsNemesis[id]
  348. }
  349.  
  350. public native_ze_set_user_nemesis(id, bool:set)
  351. {
  352.     if (!is_user_connected(id))
  353.     {
  354.         log_error(AMX_ERR_NATIVE, "[ZE] Invalid Player id (%d)", id)
  355.         return false
  356.     }
  357.  
  358.     if (set)
  359.     {
  360.         if (!g_bIsNemesis[id])
  361.             Set_Nemesis(id)
  362.     }
  363.     else
  364.     {
  365.         if (g_bIsNemesis[id])
  366.             UnSet_Nemesis(id)
  367.     }
  368.  
  369.     return true
  370. }

Mohameed not work bro
I Love Learn Languages Programmations

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 622
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#10

Post by Mohamed Alaa » 1 Month Ago

What is exactly not working?
Provide your logs.
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests