Page 1 of 3

Re: Zombie classes

Posted: 28 Jul 2018, 10:04
by Night Fury
Rain1153 wrote: 5 years ago but it didn't come :/
Add this hunter will (will be shared later) & test it.
PS: use the same sound in speed boost plugin.

| Code:

  1. #include <zombie_escape>
  2. #include <ze_zombie_class>
  3.  
  4. // Trail effect configs
  5. #define TRAIL_LIFE  2   // Life
  6. #define TRAIL_WIDTH 10  // Width
  7. #define TRAIL_RED   90  // Red color
  8. #define TRAIL_GREEN 200 // Green color
  9. #define TRAIL_BLUE  90  // Blue color
  10. #define TRAIL_ALPHA 220 // Alpha
  11.  
  12. new g_pCvarSpeedAmount, g_pCvarBoostTime, g_pCvarSpeedBoostDelay
  13. new bool:g_bCanUseSB[33], g_iCoolDown_Time[33]
  14. new g_iSpeedTrail
  15. new g_iClassID
  16.  
  17. /*-------------------START CONFIGS ----------------*/
  18. new const HUNTER_NAME[] = "Hunter"
  19. new const HUNTER_INFO[] = "Speed boost"
  20. const HUNTER_HEALTH = 1800
  21. const HUNTER_SPEED = 0.75
  22. const HUNTER_GRAVITY = 1.0
  23. /*------------------- END CONFIGS -----------------*/
  24.  
  25. new const g_iSpeedSound[] = "zombie_escape/sprint.wav"
  26.  
  27. public plugin_precache()
  28. {
  29.     g_iClassID = ze_register_zombie_class(HUNTER_NAME, HUNTER_INFO, HUNTER_HEALTH, HUNTER_SPEED, HUNTER_GRAVITY)
  30.  
  31.     precache_sound(g_iSpeedSound)
  32.     g_iSpeedTrail = precache_model("sprites/smoke.spr")
  33. }
  34.  
  35. public plugin_init()
  36. {
  37.     register_plugin("[ZE] Addons: Speed Boost", "1.0", "Jack GamePlay")
  38.  
  39.     client_clcmd("drop", "SpeedBoost")
  40.  
  41.     g_pCvarBoostTime = register_cvar("ze_boost_time", "3.0")
  42.     g_pCvarSpeedAmount = register_cvar("ze_speed_amount", "450")
  43.     g_pCvarSpeedBoostDelay = register_cvar("ze_speedboost_delay", "10.0")
  44. }
  45.  
  46. public client_putinserver(id)
  47. {
  48.     g_bCanUseSB[id] = false
  49. }
  50.  
  51. public client_disconnected(id)
  52. {
  53.     g_bCanUseSB[id] = false
  54. }
  55.  
  56. public ze_user_infected(id)
  57. {
  58.     if (!is_user_alive(id) || (ze_get_current_zombie_class(id) != g_iClassID))
  59.         return
  60.  
  61.     g_bCanUseSB[id] = true
  62.     ze_colored_print(id, "!tPress !y[!gG!y] !tto get a speed boost!y.")
  63. }
  64.  
  65. public ze_user_humanized(id)
  66. {
  67.     if (!is_user_alive(id))
  68.         return
  69.  
  70.     g_bCanUseSB[id] = false
  71. }
  72.  
  73. public SpeedBoost(id)
  74. {
  75.     if (!is_user_alive(id))
  76.         return PLUGIN_CONTINUE
  77.  
  78.     if (!ze_is_user_zombie(id))
  79.     {
  80.         ze_colored_print(id, "!tThis option is for !gzombies !tonly!y.")
  81.         return PLUGIN_HANDLED
  82.     }
  83.  
  84.     if (g_bCanUseSB[id])
  85.     {
  86.         g_bCanUseSB[id] = false
  87.         ze_set_zombie_speed(id, get_pcvar_num(g_pCvarSpeedAmount))
  88.         ze_colored_print(id, "!tYou got !y[!g%i!y] !tspeed for !y[!g%i!y] !tsec!y.", get_pcvar_num(g_pCvarSpeedAmount), floatround(get_pcvar_float(g_pCvarBoostTime)))
  89.  
  90.         message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  91.         write_byte(TE_BEAMFOLLOW)
  92.         write_short(id)
  93.         write_short(g_iSpeedTrail)
  94.         write_byte(TRAIL_LIFE)
  95.         write_byte(TRAIL_WIDTH)
  96.         write_byte(TRAIL_RED)
  97.         write_byte(TRAIL_GREEN)
  98.         write_byte(TRAIL_BLUE)
  99.         write_byte(TRAIL_ALPHA)
  100.         message_end()
  101.  
  102.         emit_sound(id, CHAN_STREAM, g_iSpeedSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  103.         set_task(get_pcvar_float(g_pCvarBoostTime), "Remove_Boost", id)
  104.     }
  105.  
  106.     return PLUGIN_CONTINUE
  107. }
  108.  
  109. public Remove_Boost(id)
  110. {
  111.     if (!is_user_alive(id) || !ze_is_user_zombie(id))
  112.         return
  113.  
  114.     g_bCanUseSB[id] = false
  115.     g_iCoolDown_Time[id] = floatround(get_pcvar_float(g_pCvarSpeedBoostDelay))
  116.     ze_reset_zombie_speed(id)
  117.     ze_colored_print(id, "!gSpeed boost has ended!y.")
  118.     set_task(1.0, "ShowHUD", id, _, _, "a", g_iCoolDown_Time[id])
  119.     set_task(get_pcvar_float(g_pCvarSpeedBoostDelay), "Allow_Again", id)
  120. }
  121.  
  122. public ShowHUD(id)
  123. {
  124.     if (!is_user_alive(id))
  125.         return
  126.  
  127.     if (!g_bCanUseSB[id])
  128.     {
  129.         g_iCoolDown_Time[id] = g_iCoolDown_Time[id] - 1
  130.         set_hudmessage(200, 200, 200, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1)
  131.         show_hudmessage(id, "Sprint cooldown: %i", g_iCoolDown_Time[id])
  132.     }
  133. }
  134.  
  135. public Allow_Again(id)
  136. {
  137.     if (!is_user_alive(id) || !ze_is_user_zombie(id))
  138.         return
  139.  
  140.     g_bCanUseSB[id] = true
  141.     ze_colored_print(id, "!gSpeed boost can be used!y.")
  142. }

Re: Zombie classes

Posted: 28 Jul 2018, 10:13
by Rain1153
You are mistaked bro...wait can you add 3 new default classes in ze class.sma? So that i can edit it from the source through defines?
Like in zp there r default 4 classes
And pls see why the ini file is not auto generated

Re: Zombie classes

Posted: 28 Jul 2018, 10:27
by Night Fury
Rain1153 wrote: 5 years ago You are mistaked bro...wait can you add 3 new default classes in ze class.sma? So that i can edit it from the source through defines?
Like in zp there r default 4 classes
And pls see why the ini file is not auto generated
The INI file is auto generated if it doesn't exist & if any plugin ran & has this native in it:

Code: Select all

native ze_register_zombie_class
We put a default zombie class in the source so it's used when there are not any added zombie classes but if there is any zombie classes, default ZClasses will be useless. Just use the hunter class i have provided you & you will understand.

Re: Zombie classes

Posted: 28 Jul 2018, 11:17
by Rain1153
so i will try to convert other zp classes too

Re: Zombie classes

Posted: 28 Jul 2018, 13:17
by johnnysins2000
we can convert zp classes into ze ?

Re: Zombie classes

Posted: 28 Jul 2018, 13:22
by Night Fury
johnnysins2000 wrote: 5 years ago we can convert zp classes into ze ?
Yes.

Re: Zombie classes

Posted: 28 Jul 2018, 13:39
by johnnysins2000
Jack GamePlay wrote: 5 years ago
johnnysins2000 wrote: 5 years ago we can convert zp classes into ze ?
Yes.
a tutorial would be good in tutorials section ?

any chances of making it ? or atleast tell me which natives i can use to convert zp classes to ze?

Re: Zombie classes

Posted: 28 Jul 2018, 13:54
by Night Fury
johnnysins2000 wrote: 5 years ago
a tutorial would be good in tutorials section ?

any chances of making it ? or at least tell me which natives i can use to convert zp classes to ze?
Check the include file & you will find all natives & forwards.
I will make a tutorial.
I'm sharing examples.

Re: Zombie classes

Posted: 04 Nov 2018, 14:14
by DarkZombie
ze_zombie_class.sma can not be converted to amxx, this is the error: (image)

Re: Zombie classes

Posted: 04 Nov 2018, 21:37
by Night Fury
DarkZombie wrote: 5 years ago ze_zombie_class.sma can not be converted to amxx, this is the error: (image)
Make a new file called "zombie_class_const.inc" & put in it the code in the first post.

Re: Zombie classes

Posted: 05 Nov 2018, 15:14
by DarkZombie
Jack GamePlay wrote: 5 years ago
DarkZombie wrote: 5 years ago ze_zombie_class.sma can not be converted to amxx, this is the error: (image)
Make a new file called "zombie_class_const.inc" & put in it the code in the first post.
Thanks its works now.
In the main menu to appear, what to do?
And in Zombie Class menu the exit button (0) write ML NOTFOUND ZEXIT.

Re: Zombie classes

Posted: 05 Nov 2018, 21:03
by DarkZombie
image

Re: Zombie classes

Posted: 06 Nov 2018, 12:10
by Night Fury
DarkZombie wrote: 5 years ago Thanks its works now.
In the main menu to appear, what to do?
And in Zombie Class menu the exit button (0) write ML NOTFOUND ZEXIT.
Updated the ze_zombie_class.sma's code, recompile it.

Re: Zombie classes

Posted: 06 Nov 2018, 19:06
by DarkZombie
Jack GamePlay wrote: 5 years ago
DarkZombie wrote: 5 years ago Thanks its works now.
In the main menu to appear, what to do?
And in Zombie Class menu the exit button (0) write ML NOTFOUND ZEXIT.
Updated the ze_zombie_class.sma's code, recompile it.
Done, its works, thank you.
The other question: In the main menu to appear, what to do? Like when i press "m" and i will see the Zombie Classes menu.

Re: Zombie classes

Posted: 06 Nov 2018, 23:15
by Night Fury
DarkZombie wrote: 5 years ago Done, its works, thank you.
The other question: In the main menu to appear, what to do? Like when i press "m" and i will see the Zombie Classes menu.
I don't understand.

Re: Zombie classes

Posted: 07 Nov 2018, 15:09
by DarkZombie
The [ZE] Main Menu list, included. Such as knife menu, weapons, etc. 4.th is Zombie Classes

Re: Zombie classes

Posted: 07 Nov 2018, 21:48
by DarkZombie
so?

Re: Zombie classes

Posted: 08 Nov 2018, 20:48
by DarkZombie
Something about it, Jack?

Re: Zombie classes

Posted: 09 Nov 2018, 11:34
by Night Fury
DarkZombie wrote: 5 years ago Something about it, Jack?
Give your main menu code.

Re: Zombie classes

Posted: 09 Nov 2018, 18:12
by DarkZombie
Here it is:

Code: Select all

#include <zombie_escape>

native ze_open_knife_menu(id)

// Keys
const OFFSET_CSMENUCODE = 205
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0

public plugin_init()
{
	register_plugin("[ZE] Main Menu", ZE_VERSION, AUTHORS)
	
	// Commands
	register_clcmd("chooseteam", "Cmd_ChooseTeam")
	register_clcmd("say /ze", "Cmd_ChooseTeam")
	register_clcmd("say_team /ze", "Cmd_ChooseTeam")
	
	// Register Menus
	register_menu("Main Menu", KEYSMENU, "Main_Menu")
}

public Cmd_ChooseTeam(id)
{
	if (!is_user_connected(id))
		return PLUGIN_CONTINUE;
	
	if (get_member(id, m_iTeam) == TEAM_TERRORIST || get_member(id, m_iTeam) == TEAM_CT)
	{
		Show_Menu_Main(id)
		return PLUGIN_HANDLED // Kill the Choose Team Command
	}
	
	// Player in Spec? Allow him to open choose team menu so he can join
	return PLUGIN_CONTINUE
}

// Main Menu
public Show_Menu_Main(id)
{
	static szMenu[250]
	new iLen
    
	// Title
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w%L^n^n", id, "MAIN_MENU_TITLE")
	
	// 1. Buy Weapons
	if (!ze_is_auto_buy_enabled(id)) // AutoBuy not enabled - normal case
	{
		if (is_user_alive(id))
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY")
		}
		else
		{
			iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d1. %L^n", id, "MENU_WEAPONBUY")
		}
	}
	else
	{
		// Auto-Buy enabled - Re-enable case
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w1.\r %L^n", id, "MENU_WEAPONBUY_RE_ENABLE")
	}
	
	// 2. Extra Items
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w2.\r %L^n", id, "MENU_EXTRABUY")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d2. %L^n", id, "MENU_EXTRABUY")
	}
	
	// 3. Knife menu
	if (is_user_alive(id))
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\w3.\r Knife menu^n")
	}
	else
	{
		iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\d3. Knife menu^n")
	}
    
	// 0. Exit
	iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n^n\w0.\r %L", id, "EXIT")
    
	// Fix for AMXX custom menus
	set_pdata_int(id, OFFSET_CSMENUCODE, 0)
	show_menu(id, KEYSMENU, szMenu, -1, "Main Menu")
}

// Main Menu
public Main_Menu(id, key)
{
	// Player disconnected?
	if (!is_user_connected(id))
		return PLUGIN_HANDLED
    
	switch (key)
	{
		case 0: // Buy Weapons
		{
			if (!ze_is_auto_buy_enabled(id))
			{
				ze_show_weapon_menu(id)
			}
			else
			{
				ze_disable_auto_buy(id)
				Show_Menu_Main(id)
			}
		}
		case 1: // Extra Items
		{
			if (is_user_alive(id))
			{
				ze_show_items_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
		case 2: // Knife menu
		{
			if (is_user_alive(id))
			{
				ze_open_knife_menu(id)
			}
			else
			{
				ze_colored_print(id, "%L", id, "DEAD_CANT_BUY_WEAPON")
			}
		}
	}
	return PLUGIN_HANDLED
}