Available ZE Beacon

Unpaid Requests, Public Plugins
Locked
kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

ZE Beacon

#1

Post by kair » 7 years ago

In this script there are lines of code for beacon can someone make the plugin for admins only to give beacon to player so they can follow him.

The code is already in here just search for beacon.

Code: Select all

/* (c) Copyright 2009 by Rube
*
*	--------------------------------------
*	---- Jailbreak Last Request ----------
*	--------------------------------------
*	---------- Author: rube --------------
*	--------------------------------------
*		About the plugin:
*	This plugin allows the last terrorist access a menu to challenge a duel 
*	(typing / lr or !Lr ) the counter-terrorist that he want.
*	--------------------------------------
*		Credits:
*	- Emp` (New AMXX Menu System)
*	- MouseSplash! (Ideas and test)
*	- cikjam (how to optimize my submenu all in one)
*	- Ganz (test)
*	--------------------------------------
*	-v1.6: Optimized duel's menu ( all in one) and set glow with fun
*	-v1.5: Added teleport for every single duel (only map some1s_jailbreak)
*	-v1.4: Added ML.
*	-V1.3: Block the menu until the TE kills the CT that he challenge.
*	-v1.2: Add shot for shot on deagle duel.
*	-V1.1: Unable touch weapons during the duel.
* 	-V1.0: First release.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#define PLUGIN "Jailbreak Last Request"
#define VERSION "1.6"
#define AUTHOR "rube"

/*================================================================================
	Variables | bools | Cvars		
=================================================================================*/

new g_maxPlayers, g_msgSayText, beacon_sprite

new cvar_granadas_bpammo, cvar_scout_bpammo, cvar_effect

new bool:touch_weapons[33], bool:once[33], bool:player_challenged[33], bool:duel_active,
bool:knife_duel[33] ,bool:deagle_duel[33], bool:grenade_duel[33], bool:scout_duel[33]

new tag[] = "[JailBreak]"

/*================================================================================
	Init n' precache		
=================================================================================*/

public plugin_precache() 
{	
	beacon_sprite = precache_model("sprites/shockwave.spr")
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	
	RegisterHam(Ham_Touch, "weaponbox", "fw_touch_weapon")
	RegisterHam(Ham_Touch, "armoury_entity", "fw_touch_weapon")
	RegisterHam(Ham_Touch, "weapon_shield", "fw_touch_weapon")
	RegisterHam(Ham_Spawn, "player", "fw_player_respawn", 1)
	RegisterHam(Ham_Killed, "player", "fw_player_killed")	
		
	register_forward(FM_CmdStart,"fw_cmdstart",1)
	
	// Comando de jugador - Client commands
	register_clcmd("say /lr", "duel_menu")
	register_clcmd("say !lr", "duel_menu")
	register_clcmd("say_team /lr", "duel_menu")
	register_clcmd("say_team !lr", "duel_menu")
	
	// Cvars
	cvar_granadas_bpammo = register_cvar("jb_grenade_bpammo","10") // amount bpammo grenade | cantidad de granadas
	cvar_scout_bpammo = register_cvar("jb_scout_bpammo", "10") // amount bpammo scout | cantidad de balas pa' la scout
	cvar_effect = register_cvar("jb_effect", "2") // 0 = glow , 1 = beacon, 2 = glow n' beacon
	
	g_maxPlayers = get_maxplayers()
	
	g_msgSayText = get_user_msgid("SayText")
	
	register_dictionary("jailbreak_last_request.txt")
}

/*================================================================================
	Round Start				
=================================================================================*/

public event_round_start()
{
	duel_active = false
}
		
/*================================================================================
	forwards				
=================================================================================*/

public fw_player_respawn(id)
{
	if(!is_user_alive(id) || !cs_get_user_team(id))
		return
	  
	set_user_rendering(id)
	remove_task(id)
	touch_weapons[id] = false 
	once[id] = false 
	knife_duel[id] = false
	deagle_duel[id] = false
	grenade_duel[id] = false
	scout_duel[id] = false	
	player_challenged[id] = false
}

public fw_touch_weapon(weapon, id)
{
	if (!is_user_connected(id))
		return HAM_IGNORED;
	
	new players[32], pnum, tempid;
	get_players(players, pnum, "a");
	for( new i; i<pnum; i++ )
	{        
		tempid = players[i];
	}
	
	if (touch_weapons[id] || touch_weapons[tempid])
		return HAM_SUPERCEDE;
	
	return HAM_IGNORED;
}


public fw_cmdstart(player,uc_handle,random_seed)
{
	if(deagle_duel[player])
	{
		cs_set_user_bpammo(player, CSW_DEAGLE, 1)
	}
}

public fw_player_killed(victim, attacker, shouldgib)
{
	new name[32]
	get_user_name(attacker, name, 31)
			
	if(duel_active)
	{
		if(cs_get_user_team(victim) == CS_TEAM_CT && player_challenged[victim])
		{
			knife_duel[attacker] = false
			deagle_duel[attacker] = false
			grenade_duel[attacker] = false
			scout_duel[attacker] = false
			once[attacker] = false
			strip_user_weapons(attacker)
			give_item(attacker, "weapon_knife")
			set_user_rendering(attacker)
			duel_menu(attacker)
		}
		else if(cs_get_user_team(victim) == CS_TEAM_CT && !player_challenged[victim])
		{
			set_task(0.4, "kill_player", attacker)
			set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
			show_hudmessage(0, "%L", LANG_PLAYER,"DUEL_DOWN", name)
				
		}
	}
	remove_task(attacker)
	remove_task(victim)
}

public kill_player(id)
{
	user_kill(id)
}

/*================================================================================
	Main Menu				
=================================================================================*/

public duel_menu(id)
{	
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
	
	if (!once[id])
	{
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			new cts[32], ts[32], ctsnum, tsnum 
	
			for (new id=1; id <= g_maxPlayers; id++)
			{
				if (!is_user_connected(id) || !is_user_alive(id)) 
				{ 
					continue 
				} 
	
				if (cs_get_user_team(id) == CS_TEAM_T) 
				{ 
					ts[tsnum++] = id
				} 
				else if (cs_get_user_team(id) == CS_TEAM_CT) 
				{ 
					cts[ctsnum++] = id
				} 
			} 
			if (tsnum == 1 && ctsnum >= 1) 
			{  
			
				static opcion[64]
	
				formatex(opcion, charsmax(opcion),"\y%L:", id, "CHOOSE_DUEL")
				new iMenu = menu_create(opcion, "sub_duel_menu")
	
				formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_1")
				menu_additem(iMenu, opcion, "1")	
	
				formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_2")
				menu_additem(iMenu, opcion, "2")
			
				formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_3")
				menu_additem(iMenu, opcion, "3")	
	
				formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_4")
				menu_additem(iMenu, opcion, "4")
			

				menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
				menu_display(id, iMenu, 0)
						
			}
			else if	(tsnum == 1 && ctsnum < 1)
			{
				ChatColor(id, "%L", LANG_PLAYER,"NOT_CTS", tag) 
			}
			else if	(tsnum > 1)
			{
				ChatColor(id, "%L", LANG_PLAYER,"ONLY_LAST", tag)
			}
		}
		else
		{
			ChatColor(id, "%L", LANG_PLAYER,"ONLY_TTS", tag) 
		}
	}
	else
	{
		ChatColor(id, "%L", LANG_PLAYER,"KILL_CHALLENGED", tag) 
	}
	return PLUGIN_HANDLED
}

public sub_duel_menu(id, menu, item)
{
	
	if (item == MENU_EXIT)
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	new Data[6], Name[64]
	new Access, Callback
	
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
	
	new Key = str_to_num(Data)
	
	switch (Key)
	{
		case 1:
		{	
			knife_duel[id] = true
			choose_enemy(id)
		}
		case 2: 
		{
			deagle_duel[id] = true
			choose_enemy(id)
		}
		case 3: 
		{
			grenade_duel[id] = true
			choose_enemy(id)
		}
		case 4: 
		{
			scout_duel[id] = true
			choose_enemy(id)
		}
	}
	
	menu_destroy(menu)	
	return PLUGIN_HANDLED
}

/*================================================================================
	Menu of challenges				
=================================================================================*/

public choose_enemy(id)
{
	static opcion[64]
	
	formatex(opcion, charsmax(opcion),"\y%L:", id, "CHOOSE_ENEMY")
	new iMenu = menu_create(opcion, "sub_choose_enemy")
	
	new players[32], pnum, tempid
	new szName[32], szTempid[10]
	
	get_players(players, pnum, "a")
	
	for( new i; i<pnum; i++ )
	{
		tempid = players[i]
		
		if (cs_get_user_team(tempid) != CS_TEAM_CT)
		{
			continue
		}
		
		get_user_name(tempid, szName, 31)
		num_to_str(tempid, szTempid, 9)
		menu_additem(iMenu, szName, szTempid, 0)
	}
	
	menu_display(id, iMenu)
	return PLUGIN_HANDLED
}

public sub_choose_enemy(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	new Data[6], Name[64]
	new Access, Callback
	menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
	
	new tempid = str_to_num(Data)
	
	new mapname[32], challenger[32], challenged[32], ct_origin[3], te_origin[3]

	get_mapname(mapname,31)
	get_user_name(id, challenger, 31)
	get_user_name(tempid, challenged, 31)
	
	// strip weapons
	strip_user_weapons(id)
	strip_user_weapons(tempid)
	
	// health
	set_user_health(id, 100)
	set_user_health(tempid, 100)
	
	// effects
	switch (get_pcvar_num(cvar_effect))
	{
		case 0: // glow
		{
			set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)	
			set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
		}
		case 1: // beacon
		{
			set_task(1.0, "beacon", id)
			set_task(1.0, "beacon", tempid)
		}
		case 2: // glow n' beacon
		{
			set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)	
			set_task(1.0, "beacon", id)
			set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
			set_task(1.0, "beacon", tempid)
		}
	}
	
	// player challenged
	player_challenged[tempid] = true
	
	// lr menu once until he kills the player challenged
	once[id] = true 
	
	// unable pick up weapon (only the 2 players on duel)
	touch_weapons[id] = true
	touch_weapons[tempid] = true
			
	if(knife_duel[id])
	{
		give_item(id, "weapon_knife")
		give_item(tempid, "weapon_knife")
				
		if(equali(mapname,"some1s_jailbreak"))
		{
			ct_origin[0] = -759, ct_origin[1] = 1047, ct_origin[2] = 100
			te_origin[0] = -585, te_origin[1] = 867, te_origin[2] = 100
			set_user_origin(id,te_origin)
			set_user_origin(tempid,ct_origin)
		}
		
		set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
		show_hudmessage(0, "%L",LANG_PLAYER,"KNIFE_DUEL", challenger, challenged)
		
	}
	else if(deagle_duel[id])
	{
		deagle_duel[tempid] = true
		
		cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 1)
		cs_set_weapon_ammo(give_item(tempid, "weapon_deagle"), 1)
		
		if(equali(mapname,"some1s_jailbreak"))
		{
			ct_origin[0] = -1352, ct_origin[1] = 271, ct_origin[2] = 38
			te_origin[0] = -1338, te_origin[1] = -782, te_origin[2] = 38
			set_user_origin(id,te_origin)
			set_user_origin(tempid,ct_origin)
		}
		
		set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
		show_hudmessage(0, "%L", LANG_PLAYER,"DEAGLE_DUEL", challenger, challenged)
	}
	else if(grenade_duel[id])
	{
		give_item(id, "weapon_hegrenade")
		give_item(tempid, "weapon_hegrenade")
		cs_set_user_bpammo(id, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))		
		cs_set_user_bpammo(tempid, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))
		
		if(equali(mapname,"some1s_jailbreak"))
		{
			ct_origin[0] = -1756, ct_origin[1] = -2526, ct_origin[2] = 36
			te_origin[0] = -3020, te_origin[1] = -2529, te_origin[2] = 36
			set_user_origin(id,te_origin)
			set_user_origin(tempid,ct_origin)
		}
		
		set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
		show_hudmessage(0, "%L", LANG_PLAYER,"GRENADE_DUEL", challenger, challenged)
	}
	else if(scout_duel[id])
	{
		give_item(id, "weapon_scout")
		give_item(tempid, "weapon_scout")
		cs_set_user_bpammo(id, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))
		cs_set_user_bpammo(tempid, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))
		
		if(equali(mapname,"some1s_jailbreak"))
		{
			ct_origin[0] = -2898, ct_origin[1] = -2040, ct_origin[2] = 37
			te_origin[0] = -2908, te_origin[1] = 905, te_origin[2] = 37
			set_user_origin(id,te_origin)
			set_user_origin(tempid,ct_origin)
		}
		
		set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
		show_hudmessage(0, "%L", LANG_PLAYER,"SCOUT_DUEL", challenger, challenged)
	}
	
	duel_active = true
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}

public beacon(id)
{
	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		static origin[3]
		get_user_origin(id, origin)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMCYLINDER)	// TE id
		write_coord(origin[0])	 	// x
		write_coord(origin[1])		// y
		write_coord(origin[2]-20)	// z
		write_coord(origin[0])    	// x axis
		write_coord(origin[1])    	// y axis
		write_coord(origin[2]+200)	// z axis
		write_short(beacon_sprite)	// sprite
		write_byte(0)			// startframe   
		write_byte(1)			// framerate   
		write_byte(6)			// life
		write_byte(2)  			// width
		write_byte(1)   			// noise    
		write_byte(0)  			// red  
		write_byte(0)   			// green 
		write_byte(250) 		// blue
		write_byte(200)			// brightness
		write_byte(0)			// speed
		message_end()
	}
	else
	{
		static origin[3]
		get_user_origin(id, origin)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMCYLINDER)	// TE id
		write_coord(origin[0])	 	// x
		write_coord(origin[1])		// y
		write_coord(origin[2]-20)	// z
		write_coord(origin[0])    	// x axis
		write_coord(origin[1])    	// y axis
		write_coord(origin[2]+200)	// z axis
		write_short(beacon_sprite)	// sprite
		write_byte(0)			// startframe   
		write_byte(1)			// framerate   
		write_byte(6)			// life
		write_byte(2)  			// width
		write_byte(1)   			// noise    
		write_byte(250)			// red  
		write_byte(0)   			// green 
		write_byte(0) 			// blue
		write_byte(200)			// brightness
		write_byte(0)			// speed
		message_end()
	}
	set_task(1.0, "beacon", id)
		
}

/*================================================================================
	Stocks					
=================================================================================*/

stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!y", "^1") // Default Color
	replace_all(msg, 190, "!team", "^3") // Team Color
	
	if (id) players[0] = id
	else get_players(players, count, "ch")
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
			write_byte(players[i])
			write_string(msg)
			message_end()
		}
	}
}

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 7 years ago

-Here it's for admins only:
    1. /* (c) Copyright 2009 by Rube
    2. *
    3. *   --------------------------------------
    4. *   ---- Jailbreak Last Request ----------
    5. *   --------------------------------------
    6. *   ---------- Author: rube --------------
    7. *   --------------------------------------
    8. *       About the plugin:
    9. *   This plugin allows the last terrorist access a menu to challenge a duel
    10. *   (typing / lr or !Lr ) the counter-terrorist that he want.
    11. *   --------------------------------------
    12. *       Credits:
    13. *   - Emp` (New AMXX Menu System)
    14. *   - MouseSplash! (Ideas and test)
    15. *   - cikjam (how to optimize my submenu all in one)
    16. *   - Ganz (test)
    17. *   --------------------------------------
    18. *   -v1.6: Optimized duel's menu ( all in one) and set glow with fun
    19. *   -v1.5: Added teleport for every single duel (only map some1s_jailbreak)
    20. *   -v1.4: Added ML.
    21. *   -V1.3: Block the menu until the TE kills the CT that he challenge.
    22. *   -v1.2: Add shot for shot on deagle duel.
    23. *   -V1.1: Unable touch weapons during the duel.
    24. *   -V1.0: First release.
    25. */
    26.  
    27. #include <amxmodx>
    28. #include <amxmisc>
    29. #include <cstrike>
    30. #include <fakemeta>
    31. #include <hamsandwich>
    32. #include <fun>
    33.  
    34. #define PLUGIN "Jailbreak Last Request"
    35. #define VERSION "1.6"
    36. #define AUTHOR "rube"
    37.  
    38. #define ADMIN_ACCESS ADMIN_BAN
    39.  
    40. /*================================================================================
    41.     Variables | bools | Cvars      
    42. =================================================================================*/
    43.  
    44. new g_maxPlayers, g_msgSayText, beacon_sprite
    45.  
    46. new cvar_granadas_bpammo, cvar_scout_bpammo, cvar_effect
    47.  
    48. new bool:touch_weapons[33], bool:once[33], bool:player_challenged[33], bool:duel_active,
    49. bool:knife_duel[33] ,bool:deagle_duel[33], bool:grenade_duel[33], bool:scout_duel[33]
    50.  
    51. new tag[] = "[JailBreak]"
    52.  
    53. /*================================================================================
    54.     Init n' precache       
    55. =================================================================================*/
    56.  
    57. public plugin_precache()
    58. {  
    59.     beacon_sprite = precache_model("sprites/shockwave.spr")
    60. }
    61.  
    62. public plugin_init()
    63. {
    64.     register_plugin(PLUGIN, VERSION, AUTHOR)
    65.    
    66.     register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    67.    
    68.     RegisterHam(Ham_Touch, "weaponbox", "fw_touch_weapon")
    69.     RegisterHam(Ham_Touch, "armoury_entity", "fw_touch_weapon")
    70.     RegisterHam(Ham_Touch, "weapon_shield", "fw_touch_weapon")
    71.     RegisterHam(Ham_Spawn, "player", "fw_player_respawn", 1)
    72.     RegisterHam(Ham_Killed, "player", "fw_player_killed")  
    73.        
    74.     register_forward(FM_CmdStart,"fw_cmdstart",1)
    75.    
    76.     // Comando de jugador - Client commands
    77.     register_clcmd("say /lr", "duel_menu")
    78.     register_clcmd("say !lr", "duel_menu")
    79.     register_clcmd("say_team /lr", "duel_menu")
    80.     register_clcmd("say_team !lr", "duel_menu")
    81.    
    82.     // Cvars
    83.     cvar_granadas_bpammo = register_cvar("jb_grenade_bpammo","10") // amount bpammo grenade | cantidad de granadas
    84.     cvar_scout_bpammo = register_cvar("jb_scout_bpammo", "10") // amount bpammo scout | cantidad de balas pa' la scout
    85.     cvar_effect = register_cvar("jb_effect", "2") // 0 = glow , 1 = beacon, 2 = glow n' beacon
    86.    
    87.     g_maxPlayers = get_maxplayers()
    88.    
    89.     g_msgSayText = get_user_msgid("SayText")
    90.    
    91.     register_dictionary("jailbreak_last_request.txt")
    92. }
    93.  
    94. /*================================================================================
    95.     Round Start            
    96. =================================================================================*/
    97.  
    98. public event_round_start()
    99. {
    100.     duel_active = false
    101. }
    102.        
    103. /*================================================================================
    104.     forwards               
    105. =================================================================================*/
    106.  
    107. public fw_player_respawn(id)
    108. {
    109.     if(!is_user_alive(id) || !cs_get_user_team(id))
    110.         return
    111.      
    112.     set_user_rendering(id)
    113.     remove_task(id)
    114.     touch_weapons[id] = false
    115.     once[id] = false
    116.     knife_duel[id] = false
    117.     deagle_duel[id] = false
    118.     grenade_duel[id] = false
    119.     scout_duel[id] = false 
    120.     player_challenged[id] = false
    121. }
    122.  
    123. public fw_touch_weapon(weapon, id)
    124. {
    125.     if (!is_user_connected(id))
    126.         return HAM_IGNORED;
    127.    
    128.     new players[32], pnum, tempid;
    129.     get_players(players, pnum, "a");
    130.     for( new i; i<pnum; i++ )
    131.     {        
    132.         tempid = players[i];
    133.     }
    134.    
    135.     if (touch_weapons[id] || touch_weapons[tempid])
    136.         return HAM_SUPERCEDE;
    137.    
    138.     return HAM_IGNORED;
    139. }
    140.  
    141.  
    142. public fw_cmdstart(player,uc_handle,random_seed)
    143. {
    144.     if(deagle_duel[player])
    145.     {
    146.         cs_set_user_bpammo(player, CSW_DEAGLE, 1)
    147.     }
    148. }
    149.  
    150. public fw_player_killed(victim, attacker, shouldgib)
    151. {
    152.     new name[32]
    153.     get_user_name(attacker, name, 31)
    154.            
    155.     if(duel_active)
    156.     {
    157.         if(cs_get_user_team(victim) == CS_TEAM_CT && player_challenged[victim])
    158.         {
    159.             knife_duel[attacker] = false
    160.             deagle_duel[attacker] = false
    161.             grenade_duel[attacker] = false
    162.             scout_duel[attacker] = false
    163.             once[attacker] = false
    164.             strip_user_weapons(attacker)
    165.             give_item(attacker, "weapon_knife")
    166.             set_user_rendering(attacker)
    167.             duel_menu(attacker)
    168.         }
    169.         else if(cs_get_user_team(victim) == CS_TEAM_CT && !player_challenged[victim])
    170.         {
    171.             set_task(0.4, "kill_player", attacker)
    172.             set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
    173.             show_hudmessage(0, "%L", LANG_PLAYER,"DUEL_DOWN", name)
    174.                
    175.         }
    176.     }
    177.     remove_task(attacker)
    178.     remove_task(victim)
    179. }
    180.  
    181. public kill_player(id)
    182. {
    183.     user_kill(id)
    184. }
    185.  
    186. /*================================================================================
    187.     Main Menu              
    188. =================================================================================*/
    189.  
    190. public duel_menu(id)
    191. {  
    192.     if(!is_user_alive(id))
    193.         return PLUGIN_HANDLED
    194.    
    195.     if (!once[id])
    196.     {
    197.         if(cs_get_user_team(id) == CS_TEAM_T)
    198.         {
    199.             new cts[32], ts[32], ctsnum, tsnum
    200.    
    201.             for (new id=1; id <= g_maxPlayers; id++)
    202.             {
    203.                 if (!is_user_connected(id) || !is_user_alive(id))
    204.                 {
    205.                     continue
    206.                 }
    207.    
    208.                 if (cs_get_user_team(id) == CS_TEAM_T)
    209.                 {
    210.                     ts[tsnum++] = id
    211.                 }
    212.                 else if (cs_get_user_team(id) == CS_TEAM_CT)
    213.                 {
    214.                     cts[ctsnum++] = id
    215.                 }
    216.             }
    217.             if (tsnum == 1 && ctsnum >= 1)
    218.             {  
    219.            
    220.                 static opcion[64]
    221.    
    222.                 formatex(opcion, charsmax(opcion),"\y%L:", id, "CHOOSE_DUEL")
    223.                 new iMenu = menu_create(opcion, "sub_duel_menu")
    224.    
    225.                 formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_1")
    226.                 menu_additem(iMenu, opcion, "1")   
    227.    
    228.                 formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_2")
    229.                 menu_additem(iMenu, opcion, "2")
    230.            
    231.                 formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_3")
    232.                 menu_additem(iMenu, opcion, "3")   
    233.    
    234.                 formatex(opcion, charsmax(opcion),"\w%L", id, "DUEL_4")
    235.                 menu_additem(iMenu, opcion, "4")
    236.            
    237.  
    238.                 menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
    239.                 menu_display(id, iMenu, 0)
    240.                        
    241.             }
    242.             else if (tsnum == 1 && ctsnum < 1)
    243.             {
    244.                 ChatColor(id, "%L", LANG_PLAYER,"NOT_CTS", tag)
    245.             }
    246.             else if (tsnum > 1)
    247.             {
    248.                 ChatColor(id, "%L", LANG_PLAYER,"ONLY_LAST", tag)
    249.             }
    250.         }
    251.         else
    252.         {
    253.             ChatColor(id, "%L", LANG_PLAYER,"ONLY_TTS", tag)
    254.         }
    255.     }
    256.     else
    257.     {
    258.         ChatColor(id, "%L", LANG_PLAYER,"KILL_CHALLENGED", tag)
    259.     }
    260.     return PLUGIN_HANDLED
    261. }
    262.  
    263. public sub_duel_menu(id, menu, item)
    264. {
    265.    
    266.     if (item == MENU_EXIT)
    267.     {
    268.         menu_destroy(menu)
    269.         return PLUGIN_HANDLED
    270.     }
    271.    
    272.     new Data[6], Name[64]
    273.     new Access, Callback
    274.    
    275.     menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
    276.    
    277.     new Key = str_to_num(Data)
    278.    
    279.     switch (Key)
    280.     {
    281.         case 1:
    282.         {  
    283.             knife_duel[id] = true
    284.             choose_enemy(id)
    285.         }
    286.         case 2:
    287.         {
    288.             deagle_duel[id] = true
    289.             choose_enemy(id)
    290.         }
    291.         case 3:
    292.         {
    293.             grenade_duel[id] = true
    294.             choose_enemy(id)
    295.         }
    296.         case 4:
    297.         {
    298.             scout_duel[id] = true
    299.             choose_enemy(id)
    300.         }
    301.     }
    302.    
    303.     menu_destroy(menu) 
    304.     return PLUGIN_HANDLED
    305. }
    306.  
    307. /*================================================================================
    308.     Menu of challenges             
    309. =================================================================================*/
    310.  
    311. public choose_enemy(id)
    312. {
    313.     static opcion[64]
    314.    
    315.     formatex(opcion, charsmax(opcion),"\y%L:", id, "CHOOSE_ENEMY")
    316.     new iMenu = menu_create(opcion, "sub_choose_enemy")
    317.    
    318.     new players[32], pnum, tempid
    319.     new szName[32], szTempid[10]
    320.    
    321.     get_players(players, pnum, "a")
    322.    
    323.     for( new i; i<pnum; i++ )
    324.     {
    325.         tempid = players[i]
    326.        
    327.         if (cs_get_user_team(tempid) != CS_TEAM_CT)
    328.         {
    329.             continue
    330.         }
    331.        
    332.         get_user_name(tempid, szName, 31)
    333.         num_to_str(tempid, szTempid, 9)
    334.         menu_additem(iMenu, szName, szTempid, 0)
    335.     }
    336.    
    337.     menu_display(id, iMenu)
    338.     return PLUGIN_HANDLED
    339. }
    340.  
    341. public sub_choose_enemy(id, menu, item)
    342. {
    343.     if( item == MENU_EXIT )
    344.     {
    345.         menu_destroy(menu)
    346.         return PLUGIN_HANDLED
    347.     }
    348.    
    349.     new Data[6], Name[64]
    350.     new Access, Callback
    351.     menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback)
    352.    
    353.     new tempid = str_to_num(Data)
    354.    
    355.     new mapname[32], challenger[32], challenged[32], ct_origin[3], te_origin[3]
    356.  
    357.     get_mapname(mapname,31)
    358.     get_user_name(id, challenger, 31)
    359.     get_user_name(tempid, challenged, 31)
    360.    
    361.     // strip weapons
    362.     strip_user_weapons(id)
    363.     strip_user_weapons(tempid)
    364.    
    365.     // health
    366.     set_user_health(id, 100)
    367.     set_user_health(tempid, 100)
    368.    
    369.     // effects
    370.     switch (get_pcvar_num(cvar_effect))
    371.     {
    372.         case 0: // glow
    373.         {
    374.             set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)   
    375.             set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
    376.         }
    377.         case 1: // beacon
    378.         {
    379.             set_task(1.0, "beacon", id)
    380.             set_task(1.0, "beacon", tempid)
    381.         }
    382.         case 2: // glow n' beacon
    383.         {
    384.             set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)   
    385.             set_task(1.0, "beacon", id)
    386.             set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
    387.             set_task(1.0, "beacon", tempid)
    388.         }
    389.     }
    390.    
    391.     // player challenged
    392.     player_challenged[tempid] = true
    393.    
    394.     // lr menu once until he kills the player challenged
    395.     once[id] = true
    396.    
    397.     // unable pick up weapon (only the 2 players on duel)
    398.     touch_weapons[id] = true
    399.     touch_weapons[tempid] = true
    400.            
    401.     if(knife_duel[id])
    402.     {
    403.         give_item(id, "weapon_knife")
    404.         give_item(tempid, "weapon_knife")
    405.                
    406.         if(equali(mapname,"some1s_jailbreak"))
    407.         {
    408.             ct_origin[0] = -759, ct_origin[1] = 1047, ct_origin[2] = 100
    409.             te_origin[0] = -585, te_origin[1] = 867, te_origin[2] = 100
    410.             set_user_origin(id,te_origin)
    411.             set_user_origin(tempid,ct_origin)
    412.         }
    413.        
    414.         set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
    415.         show_hudmessage(0, "%L",LANG_PLAYER,"KNIFE_DUEL", challenger, challenged)
    416.        
    417.     }
    418.     else if(deagle_duel[id])
    419.     {
    420.         deagle_duel[tempid] = true
    421.        
    422.         cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 1)
    423.         cs_set_weapon_ammo(give_item(tempid, "weapon_deagle"), 1)
    424.        
    425.         if(equali(mapname,"some1s_jailbreak"))
    426.         {
    427.             ct_origin[0] = -1352, ct_origin[1] = 271, ct_origin[2] = 38
    428.             te_origin[0] = -1338, te_origin[1] = -782, te_origin[2] = 38
    429.             set_user_origin(id,te_origin)
    430.             set_user_origin(tempid,ct_origin)
    431.         }
    432.        
    433.         set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
    434.         show_hudmessage(0, "%L", LANG_PLAYER,"DEAGLE_DUEL", challenger, challenged)
    435.     }
    436.     else if(grenade_duel[id])
    437.     {
    438.         give_item(id, "weapon_hegrenade")
    439.         give_item(tempid, "weapon_hegrenade")
    440.         cs_set_user_bpammo(id, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))      
    441.         cs_set_user_bpammo(tempid, CSW_HEGRENADE,get_pcvar_num(cvar_granadas_bpammo))
    442.        
    443.         if(equali(mapname,"some1s_jailbreak"))
    444.         {
    445.             ct_origin[0] = -1756, ct_origin[1] = -2526, ct_origin[2] = 36
    446.             te_origin[0] = -3020, te_origin[1] = -2529, te_origin[2] = 36
    447.             set_user_origin(id,te_origin)
    448.             set_user_origin(tempid,ct_origin)
    449.         }
    450.        
    451.         set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
    452.         show_hudmessage(0, "%L", LANG_PLAYER,"GRENADE_DUEL", challenger, challenged)
    453.     }
    454.     else if(scout_duel[id])
    455.     {
    456.         give_item(id, "weapon_scout")
    457.         give_item(tempid, "weapon_scout")
    458.         cs_set_user_bpammo(id, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))
    459.         cs_set_user_bpammo(tempid, CSW_SCOUT, get_pcvar_num(cvar_scout_bpammo))
    460.        
    461.         if(equali(mapname,"some1s_jailbreak"))
    462.         {
    463.             ct_origin[0] = -2898, ct_origin[1] = -2040, ct_origin[2] = 37
    464.             te_origin[0] = -2908, te_origin[1] = 905, te_origin[2] = 37
    465.             set_user_origin(id,te_origin)
    466.             set_user_origin(tempid,ct_origin)
    467.         }
    468.        
    469.         set_hudmessage( 0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
    470.         show_hudmessage(0, "%L", LANG_PLAYER,"SCOUT_DUEL", challenger, challenged)
    471.     }
    472.    
    473.     duel_active = true
    474.    
    475.     menu_destroy(menu)
    476.     return PLUGIN_HANDLED
    477. }
    478.  
    479. public beacon(id)
    480. {
    481.     if (get_user_flags(id) & ADMIN_ACCESS)
    482.     {
    483.         if(cs_get_user_team(id) == CS_TEAM_CT)
    484.         {
    485.             static origin[3]
    486.             get_user_origin(id, origin)
    487.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    488.             write_byte(TE_BEAMCYLINDER) // TE id
    489.             write_coord(origin[0])      // x
    490.             write_coord(origin[1])      // y
    491.             write_coord(origin[2]-20)   // z
    492.             write_coord(origin[0])      // x axis
    493.             write_coord(origin[1])      // y axis
    494.             write_coord(origin[2]+200)  // z axis
    495.             write_short(beacon_sprite)  // sprite
    496.             write_byte(0)           // startframe  
    497.             write_byte(1)           // framerate  
    498.             write_byte(6)           // life
    499.             write_byte(2)           // width
    500.             write_byte(1)               // noise    
    501.             write_byte(0)           // red  
    502.             write_byte(0)               // green
    503.             write_byte(250)         // blue
    504.             write_byte(200)         // brightness
    505.             write_byte(0)           // speed
    506.             message_end()
    507.         }
    508.         else
    509.         {
    510.             static origin[3]
    511.             get_user_origin(id, origin)
    512.             message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    513.             write_byte(TE_BEAMCYLINDER) // TE id
    514.             write_coord(origin[0])      // x
    515.             write_coord(origin[1])      // y
    516.             write_coord(origin[2]-20)   // z
    517.             write_coord(origin[0])      // x axis
    518.             write_coord(origin[1])      // y axis
    519.             write_coord(origin[2]+200)  // z axis
    520.             write_short(beacon_sprite)  // sprite
    521.             write_byte(0)           // startframe  
    522.             write_byte(1)           // framerate  
    523.             write_byte(6)           // life
    524.             write_byte(2)           // width
    525.             write_byte(1)               // noise    
    526.             write_byte(250)         // red  
    527.             write_byte(0)               // green
    528.             write_byte(0)           // blue
    529.             write_byte(200)         // brightness
    530.             write_byte(0)           // speed
    531.             message_end()
    532.         }
    533.        
    534.         set_task(1.0, "beacon", id)
    535.     }
    536. }
    537.  
    538. /*================================================================================
    539.     Stocks                 
    540. =================================================================================*/
    541.  
    542. stock ChatColor(const id, const input[], any:...)
    543. {
    544.     new count = 1, players[32]
    545.     static msg[191]
    546.     vformat(msg, 190, input, 3)
    547.    
    548.     replace_all(msg, 190, "!g", "^4") // Green Color
    549.     replace_all(msg, 190, "!y", "^1") // Default Color
    550.     replace_all(msg, 190, "!team", "^3") // Team Color
    551.    
    552.     if (id) players[0] = id
    553.     else get_players(players, count, "ch")
    554.     for (new i = 0; i < count; i++)
    555.     {
    556.         if (is_user_connected(players[i]))
    557.         {
    558.             message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i])
    559.             write_byte(players[i])
    560.             write_string(msg)
    561.             message_end()
    562.         }
    563.     }
    564. }
-Change Admin Access from line 38:
  • #define ADMIN_ACCESS ADMIN_BAN
Last edited by Raheem 7 years ago, edited 1 time in total.
Reason: Simple Edit....
He who fails to plan is planning to fail

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#3

Post by kair » 7 years ago

U probably dont know what i mean I want to remove most of all the codes and use the code for beacon to make a new plugin to give ->

amx_beacon "player"
I dont need the duel and the rest of the stuff in the code.

So that player gets a beacon around him -> In zombie Escape players can follow him if they dont know the map.

Kinda like amx_glow but this toggles a circle around the player

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 7 years ago

You don't say you need new plugin. I'll make it when i get time.
He who fails to plan is planning to fail

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#5

Post by johnnysins2000 » 7 years ago

kair wrote: 7 years ago U probably dont know what i mean I want to remove most of all the codes and use the code for beacon to make a new plugin to give ->

amx_beacon "player"
I dont need the duel and the rest of the stuff in the code.

So that player gets a beacon around him -> In zombie Escape players can follow him if they dont know the map.

Kinda like amx_glow but this toggles a circle around the player
What U need is Trail Plugin code in this Try to explain me here And Maybe I will do it if I get time Because we all are busy Nowadays in exams
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#6

Post by kair » 7 years ago

new g_maxPlayers, g_msgSayText, >>beacon_sprite<< this I need

case 0: // glow
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)
set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
}
case 1: // beacon
{
set_task(1.0, "beacon", id)
set_task(1.0, "beacon", tempid)
}
case 2: // glow n' beacon
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)

I want to give case 1 or case 2 to players so the rest of the stuff is not needed.

I want to give it like amx_beacon [id] to a player for 1 whole round.

johnnysins2000
Veteran Member
Veteran Member
Paraguay
Posts: 678
Joined: 7 years ago
Location: Paraguay
Contact:

#7

Post by johnnysins2000 » 7 years ago

kair wrote: 7 years ago new g_maxPlayers, g_msgSayText, >>beacon_sprite<< this I need

case 0: // glow
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)
set_user_rendering(tempid, kRenderFxGlowShell, 0, 0, 250, kRenderNormal, 20)
}
case 1: // beacon
{
set_task(1.0, "beacon", id)
set_task(1.0, "beacon", tempid)
}
case 2: // glow n' beacon
{
set_user_rendering(id, kRenderFxGlowShell, 250, 0, 0, kRenderNormal, 20)

I want to give case 1 or case 2 to players so the rest of the stuff is not needed.

I want to give it like amx_beacon [id] to a player for 1 whole round.
Lol your problem is simple why u are using this plugin ? Better solution is that we will need to make a new plugin for it u need is beacon and and Glow code in it only
Nobody Is That Busy If They Make Time :roll:

kair
Member
Member
Posts: 25
Joined: 7 years ago
Contact:

#8

Post by kair » 7 years ago

That is exactly what I want :D This part of the code is just usefull to make a new plugin "beacon"

I forgot to mension i also want a beep sound on the player when he has a beacon on him.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 7 years ago

Plugin Available Here. And about the sound just post the sound file in the plugin thread and i'll add it.

Thread Locked.
He who fails to plan is planning to fail

Locked

Who is online

Users browsing this forum: No registered users and 0 guests