Page 1 of 1

Radio Commands

Posted: 30 Jul 2017, 23:50
by Spir0x
Hi guys can anyone make plugin for Radio commands ? w,x,c

Like: Cover me and Let's go move back now!

i have sounds just make plugin.

i think it's good :)

Re: Radio Commands

Posted: 31 Jul 2017, 01:00
by Raheem
What you mean bro? To disable the main radio and replace with yours?

Re: Radio Commands

Posted: 31 Jul 2017, 10:12
by johnnysins2000
I have the plugin bro
+ it is already done in my Windows Pack

The old windows pack bro

I think I have upload sma of it

If u don't find it I will give u the code here

But make sure u compile it With Amxmodx 1.8.3 compiler

Otherwise it won't work in new mod

Re: Radio Commands

Posted: 31 Jul 2017, 17:53
by Spir0x
yes that's why i requested here.
yes raheem i mean make another colored like \rRadio Commands\w:
1.Cover Me! i have sound of it
2. Let's go move back now!!
.. like this if u like this i can upload all this radio sounds.

Re: Radio Commands

Posted: 01 Aug 2017, 05:03
by Raheem
Already made bro: https://forums.alliedmods.net/showthread.php?p=490083

Search next time.

Re: Radio Commands

Posted: 02 Aug 2017, 21:57
by Spir0x
ok thanks.

Re: Radio Commands

Posted: 03 Aug 2017, 11:22
by Raheem
Marked as solved.

Re: Radio Commands

Posted: 04 Aug 2017, 21:52
by Spir0x
Not solved xD zombies can use radio commands too. :/

Re: Radio Commands

Posted: 07 Aug 2017, 14:04
by Raheem
Use this check to solve your problem:

Re: Radio Commands

Posted: 09 Aug 2017, 18:09
by Spir0x
Raheem i added but i think it needs #include <zombie_escape>

Code:

Code: Select all

// DODAC CVAR

#include <amxmodx> 
#include <amxmisc>
#include <engine>
#include <csx>
#include <fakemeta>


#define PLUGIN "Custom Radio Commands"
#define VERSION "0.6"
#define AUTHOR "KaLoSZyFeR"


new g_RadioTimer[33]

/* CONFIG SETUP */
new CRcoverme[64]
new CRtakepoint[64]
new CRhposition[64]
new CRregroup[64]
new CRfollowme[64]
new CRfireassis[64]

new CRgo[64]
new CRfallback[64]
new CRsticktog[64]
new CRgetinpos[64]
new CRstormfront[64]
new CRreportin[64]

new CRroger[64]
new CRenemys[64]
new CRbackup[64]
new CRclear[64]
new CRposition[64]
new CRreportingin[64]
new CRgetoutblow[64]
new CRnegative[64]
new CRenemydown[64]

new CRexit[64]
new CRcolortitle[2]
new CRcolormenu[2]

//version 0.6
new CRfireinhole[64]

// Radio1 wav files 
stock const radio1_spk[6][] ={   
	"radio/ze_radio/ct_coverme.wav", 
	"radio/ze_radio/takepoint.wav", 
	"radio/ze_radio/position.wav", 
	"radio/ze_radio/regroup.wav", 
	"radio/ze_radio/followme.wav", 
	"radio/ze_radio/fireassis.wav" 
} 


public radio1(id) {   // Client used Radio1 commands 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	// What Radio1 menu will look like
	new key1 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body1[512]
	new len1 = format(menu_body1,511,"\%sRadio Commands A\%s^n\ ", CRcolortitle, CRcolormenu)
	len1 += format( menu_body1[len1], 511-len1, "^n\ " )
	len1 += format( menu_body1[len1], 511-len1, "1. %s^n\ ", CRcoverme)
	len1 += format( menu_body1[len1], 511-len1, "2. %s^n\ ", CRtakepoint)
	len1 += format( menu_body1[len1], 511-len1, "3. %s^n\ ", CRhposition)
	len1 += format( menu_body1[len1], 511-len1, "4. %s^n\ ", CRregroup)
	len1 += format( menu_body1[len1], 511-len1, "5. %s^n\ ", CRfollowme)
	len1 += format( menu_body1[len1], 511-len1, "6. %s^n\ ", CRfireassis)
	len1 += format( menu_body1[len1], 511-len1, "^n\ " )
	len1 += format( menu_body1[len1], 511-len1, "0. %s", CRexit)
	show_menu(id,key1,menu_body1) // Show the above menu on screen 
	return PLUGIN_HANDLED 
} 

public radio1cmd(id, key1) { 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
         if (ze_is_user_zombie(id))
         return
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	if(g_RadioTimer[id] == 1) return PLUGIN_HANDLED
	new players[32],total, team_name[10] 
	get_user_team(id,team_name, 9) 
	get_players(players, total ,"ce", team_name) // No bots and Match team name
	new name[32]
	get_user_name(id,name,31)
	for(new a=0; a < total; ++a) { 
		client_cmd(players[a], "spk ^"%s^"", radio1_spk[key1])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio1_spk[key1] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players[a],print_chat,"%s (RADIO): %s",name, radio1_say[key1])
		new message1[64]
		
		switch (key1) {
			case 0: { // 1
			message1 = CRcoverme	
			}
			case 1: { // 2
			message1 = CRtakepoint
			}
			case 2: { // 3
			message1 = CRhposition
			}
			case 3: { // 4
			message1 = CRregroup
			}
			case 4: { // 5
			message1 = CRfollowme
			}
			case 5: { // 6
			message1 = CRfireassis
			}
		}
		client_print(players[a],print_chat,"%s (RADIO): %s",name, message1)
		g_RadioTimer[id] = 1
		set_task(2.0,"radiotimer",id)
	}
	return PLUGIN_HANDLED 
} 



// Radio2 wav files 

stock const radio2_spk[6][] =  {   
	
	
	"radio/ze_radio/com_go.wav", 
	"radio/ze_radio/fallback.wav", 
	"radio/ze_radio/sticktog.wav", 
	"radio/ze_radio/com_getinpos.wav", 
	"radio/ze_radio/stormfront.wav", 
	"radio/ze_radio/com_reportin.wav"
} 

public radio2(id) {   // Client used Radio2 commands 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	// What Radio2 menu will look like
	new key2 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body2[512]
	new len2 = format(menu_body2,511,"\%sRadio Commands B\%s^n\ ", CRcolortitle, CRcolormenu)
	len2 += format( menu_body2[len2], 511-len2, "^n\ " )
	len2 += format( menu_body2[len2], 511-len2, "1. %s^n\ ", CRgo)
	len2 += format( menu_body2[len2], 511-len2, "2. %s^n\ ", CRfallback)
	len2 += format( menu_body2[len2], 511-len2, "3. %s^n\ ", CRsticktog)
	len2 += format( menu_body2[len2], 511-len2, "4. %s^n\ ", CRgetinpos)
	len2 += format( menu_body2[len2], 511-len2, "5. %s^n\ ", CRstormfront)
	len2 += format( menu_body2[len2], 511-len2, "6. %s^n\ ", CRreportin)
	len2 += format( menu_body2[len2], 511-len2, "^n\ " )
	len2 += format( menu_body2[len2], 511-len2, "0. %s", CRexit)
	
	show_menu(id,key2,menu_body2) // Show the above menu on screen 
	return PLUGIN_HANDLED 
}

public radio2cmd(id, key2) { 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	if(g_RadioTimer[id] == 1) return PLUGIN_HANDLED
	new players2[32],total2, team_name2[10] 
	get_user_team(id,team_name2, 9) 
	get_players(players2, total2 ,"ce", team_name2) // No bots and Match team name
	new name2[32]
	get_user_name(id,name2,31)
	for(new a2=0; a2 < total2; ++a2) { 
		client_cmd(players2[a2], "spk ^"%s^"", radio2_spk[key2])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio2_spk[key2] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players2[a2],print_chat,"%s (RADIO): %s",name2,radio2_say[key2]) // Print radio message on screen
		new message2[64]
		
		switch (key2) {
			case 0: { // 1
			message2 = CRgo	
			}
			case 1: { // 2
			message2 = CRfallback
			}
			case 2: { // 3
			message2 = CRsticktog
			}
			case 3: { // 4
			message2 = CRgetinpos
			}
			case 4: { // 5
			message2 = CRstormfront
			}
			case 5: { // 6
			message2 = CRreportin
			}
		}
		client_print(players2[a2],print_chat,"%s (RADIO): %s",name2, message2)
		g_RadioTimer[id] = 1
		set_task(2.0,"radiotimer",id)
	}
	return PLUGIN_HANDLED 
} 


// Radio3 wav files 

stock const radio3_spk[9][] =  {   
	
	
	"radio/ze_radio/roger.wav", 
	"radio/ze_radio/ct_enemys.wav", 
	"radio/ze_radio/ct_backup.wav", 
	"radio/ze_radio/clear.wav", 
	"radio/ze_radio/ct_inpos.wav", 
	"radio/ze_radio/ct_reportingin.wav", 
	"radio/ze_radio/blow.wav", 
	"radio/ze_radio/negative.wav", 
	"radio/ze_radio/enemydown.wav" 
} 

public radio3(id) {   // Client used Radio3 commands 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	// What Radio3 menu will look like
	new key3 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
	
	new menu_body3[512]
	new len3 = format(menu_body3,511,"\%sRadio Commands C\%s^n\ ", CRcolortitle, CRcolormenu)
	len3 += format( menu_body3[len3], 511-len3, "^n\ " )
	len3 += format( menu_body3[len3], 511-len3, "1. %s^n\ ", CRroger)
	len3 += format( menu_body3[len3], 511-len3, "2. %s^n\ ", CRenemys)
	len3 += format( menu_body3[len3], 511-len3, "3. %s^n\ ", CRbackup)
	len3 += format( menu_body3[len3], 511-len3, "4. %s^n\ ", CRclear)
	len3 += format( menu_body3[len3], 511-len3, "5. %s^n\ ", CRposition)
	len3 += format( menu_body3[len3], 511-len3, "6. %s^n\ ", CRreportingin)
	len3 += format( menu_body3[len3], 511-len3, "7. %s^n\ ", CRgetoutblow)
	len3 += format( menu_body3[len3], 511-len3, "8. %s^n\ ", CRnegative)
	len3 += format( menu_body3[len3], 511-len3, "9. %s^n\ ", CRenemydown)
	len3 += format( menu_body3[len3], 511-len3, "^n\ " )
	len3 += format( menu_body3[len3], 511-len3, "0. %s", CRexit)
	
	show_menu(id,key3,menu_body3) // Show the above menu on screen 
	return PLUGIN_HANDLED 
} 

public radio3cmd(id, key3) { 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	if(g_RadioTimer[id] == 1) return PLUGIN_HANDLED
	new players3[32],total3, team_name3[10] 
	get_user_team(id,team_name3, 9) 
	get_players(players3, total3 ,"ce", team_name3) // No bots and Match team name
	new name3[32]
	get_user_name(id,name3,31)
	for(new a3=0; a3 < total3; ++a3) { 
		client_cmd(players3[a3], "spk ^"%s^"", radio3_spk[key3])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio3_spk[key3] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players3[a3],print_chat,"%s (RADIO): %s",name3,radio3_say[key3]) // Print radio message on screen
		new message3[64]
		
		switch (key3) {
			case 0: { // 1
			message3 = CRroger	
			}
			case 1: { // 2
			message3 = CRenemys
			}
			case 2: { // 3
			message3 = CRbackup
			}
			case 3: { // 4
			message3 = CRclear
			}
			case 4: { // 5
			message3 = CRposition
			}
			case 5: { // 6
			message3 = CRreportingin
			}
			case 6: { // 7
			message3 = CRgetoutblow
			}
			case 7: { // 8
			message3 = CRnegative
			}
			case 8: { // 9
			message3 = CRenemydown
			}
		}
		client_print(players3[a3],print_chat,"%s (RADIO): %s",name3, message3)
		
		g_RadioTimer[id] = 1
		set_task(2.0,"radiotimer",id)
	}
	return PLUGIN_HANDLED 
} 


public plugin_precache() {
	
	precache_sound(radio1_spk[0])
	precache_sound(radio1_spk[1])
	precache_sound(radio1_spk[2])
	precache_sound(radio1_spk[3])
	precache_sound(radio1_spk[4])
	precache_sound(radio1_spk[5])
		
	precache_sound(radio2_spk[0])
	precache_sound(radio2_spk[1])
	precache_sound(radio2_spk[2])
	precache_sound(radio2_spk[3])
	precache_sound(radio2_spk[4])
	precache_sound(radio2_spk[5])
	
	precache_sound(radio3_spk[0])
	precache_sound(radio3_spk[1])
	precache_sound(radio3_spk[2])
	precache_sound(radio3_spk[3])
	precache_sound(radio3_spk[4])
	precache_sound(radio3_spk[5])
	precache_sound(radio3_spk[6])
	precache_sound(radio3_spk[7])
	precache_sound(radio3_spk[8])
	
	precache_sound("radio/custom/ct_fireinhole.wav")
	
	return PLUGIN_CONTINUE 
} 

public plugin_init(){
	
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("radio1", "radio1", 0, "- Calls radio menu 1")
	register_clcmd("radio2", "radio2", 0, "- Calls radio menu 2")
	register_clcmd("radio3", "radio3", 0, "- Calls radio menu 3")
	register_menucmd(register_menuid("Radio Commands A"),511,"radio1cmd")
	register_menucmd(register_menuid("Radio Commands B"),511,"radio2cmd")
	register_menucmd(register_menuid("Radio Commands C"),511,"radio3cmd")

	register_cvar("amx_custom_radio", "1")
	register_cvar("amx_real_radio", "1")
	register_cvar("amx_radio_info", "1")
	
	register_cvar("CRcoverme", "radio")
	register_cvar("CRtakepoint", "radio")
	register_cvar("CRhposition", "radio")
	register_cvar("CRregroup", "radio")
	register_cvar("CRfollowme", "radio")
	register_cvar("CRfireassis", "radio")
	
	register_cvar("CRgo", "radio")
	register_cvar("CRfallback", "radio")
	register_cvar("CRsticktog", "radio")
	register_cvar("CRgetinpos", "radio")
	register_cvar("CRstormfront", "radio")
	register_cvar("CRreportin", "radio")

	register_cvar("CRroger", "radio")
	register_cvar("CRenemys", "radio")
	register_cvar("CRbackup", "radio")
	register_cvar("CRclear", "radio")
	register_cvar("CRposition", "radio")
	register_cvar("CRreportingin", "radio")
	register_cvar("CRgetoutblow", "radio")
	register_cvar("CRnegative", "radio")
	register_cvar("CRenemydown", "radio")
	
	register_cvar("CRexit", "radio")
	register_cvar("CRcolortitle", "r")
	register_cvar("CRcolormenu", "w")
	
	register_cvar("CRfireinhole", "radio")
		
	register_message(get_user_msgid("TextMsg"), "message")
	register_message(get_user_msgid("SendAudio"), "msg_audio")
	
	//version 0.6
	register_clcmd("coverme", "komenda", 0, "- Quick radio command")
	register_clcmd("takepoint", "komenda", 0, "- Quick radio command")
	register_clcmd("holdpos", "komenda", 0, "- Quick radio command")
	register_clcmd("regroup", "komenda", 0, "- Quick radio command")
	register_clcmd("followme", "komenda", 0, "- Quick radio command")
	register_clcmd("takingfire", "komenda", 0, "- Quick radio command")
	
	register_clcmd("go", "komenda", 0, "- Quick radio command")
	register_clcmd("fallback", "komenda", 0, "- Quick radio command")
	register_clcmd("sticktog", "komenda", 0, "- Quick radio command")
	register_clcmd("getinpos", "komenda", 0, "- Quick radio command")
	register_clcmd("stormfront", "komenda", 0, "- Quick radio command")
	register_clcmd("report", "komenda", 0, "- Quick radio command")
	
	register_clcmd("roger", "komenda", 0, "- Quick radio command")
	register_clcmd("enemyspot", "komenda", 0, "- Quick radio command")
	register_clcmd("needbackup", "komenda", 0, "- Quick radio command")
	register_clcmd("sectorclear", "komenda", 0, "- Quick radio command")
	register_clcmd("inposition", "komenda", 0, "- Quick radio command")
	register_clcmd("reportingin", "komenda", 0, "- Quick radio command")
	register_clcmd("getout", "komenda", 0, "- Quick radio command")
	register_clcmd("negative", "komenda", 0, "- Quick radio command")
	register_clcmd("enemydown", "komenda", 0, "- Quick radio command")

	new configsDir[64]
	get_configsdir(configsDir, 63)
	
	server_cmd("exec %s/custom_radio.cfg", configsDir)
	server_exec()
				
	return PLUGIN_CONTINUE  
}

public message()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE

	if(get_msg_args() != 4 || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(4) != ARG_STRING)
	{
		return PLUGIN_CONTINUE
	}

	new arg2[16]
	get_msg_arg_string(2, arg2, 15)
	if(!equal(arg2, "#Game_radio"))
	{
		return PLUGIN_CONTINUE
	}
	
	new arg4[20]
	get_msg_arg_string(4, arg4, 19)
	if(equal(arg4, "#Fire_in_the_hole"))
	{
		set_msg_arg_string(4, CRfireinhole)
		return PLUGIN_CONTINUE
	}
	
	return PLUGIN_CONTINUE
}

public msg_audio()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {
		return PLUGIN_CONTINUE
	}

	new arg2[20]
	get_msg_arg_string(2, arg2, 19)
	if(equal(arg2[1], "!MRAD_FIREINHOLE"))
	{
			return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public grenade_throw(id,ent,wid)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	new players[32],total, team_name[10] 
	get_user_team(id,team_name, 9) 
	get_players(players, total ,"ce", team_name) // No bots and Match team name
	new name[32]
	get_user_name(id,name,31)
	for(new a=0; a < total; ++a)
	{ 
		client_cmd(players[a], "spk radio/custom/ct_fireinhole.wav")
		if (get_cvar_num("amx_real_radio"))  
		{
		emit_sound(id, CHAN_VOICE, "radio/custom/ct_fireinhole.wav" , 0.9, ATTN_STATIC, 0, PITCH_NORM)  
		}
	}
	return PLUGIN_HANDLED
}
	
public radiotimer(id) {
	g_RadioTimer[id] = 0
	return PLUGIN_HANDLED
}

public client_connect(id) {
	g_RadioTimer[id] = 0
}

public client_disconnect(id) {
	g_RadioTimer[id] = 0
}


public client_putinserver(id)	
{
	set_task(20.0, "dispInfo", id)
}

public dispInfo(id)
{
	if (get_cvar_num("amx_radio_info")) 
		//client_print(id,print_chat,"Plugin 'Custom Radio Commands' jest uruchomiony na tym serwerze. Kontakt z autorem: kaloszyfer@o2.pl")
		client_print(id,print_chat,"'Custom Radio Commands' plugin is running on this server. Contact with author: kaloszyfer@o2.pl")
}

public plugin_cfg()
{

	get_cvar_string("CRcoverme", CRcoverme, 63)
	get_cvar_string("CRtakepoint", CRtakepoint, 63)
	get_cvar_string("CRhposition", CRhposition, 63)
	get_cvar_string("CRregroup", CRregroup, 63)
	get_cvar_string("CRfollowme", CRfollowme, 63)
	get_cvar_string("CRfireassis", CRfireassis, 63)

	get_cvar_string("CRgo", CRgo, 63)
	get_cvar_string("CRfallback", CRfallback, 63)
	get_cvar_string("CRsticktog", CRsticktog, 63)
	get_cvar_string("CRgetinpos", CRgetinpos, 63)
	get_cvar_string("CRstormfront", CRstormfront, 63)
	get_cvar_string("CRreportin", CRreportin, 63)
	
	get_cvar_string("CRroger", CRroger, 63)
	get_cvar_string("CRenemys", CRenemys, 63)
	get_cvar_string("CRbackup", CRbackup, 63)
	get_cvar_string("CRclear", CRclear, 63)
	get_cvar_string("CRposition", CRposition, 63)
	get_cvar_string("CRreportingin", CRreportingin, 63)
	get_cvar_string("CRgetoutblow", CRgetoutblow, 63)
	get_cvar_string("CRnegative", CRnegative, 63)
	get_cvar_string("CRenemydown", CRenemydown, 63)
	
	get_cvar_string("CRexit", CRexit, 63)
	get_cvar_string("CRcolortitle", CRcolortitle, 1)
	get_cvar_string("CRcolormenu", CRcolormenu, 1)
	
	//version 0.6
	get_cvar_string("CRfireinhole", CRfireinhole, 63)
	
}

//version 0.6
new cmd_radio1[6][] =
{
	"coverme",
	"takepoint",
	"holdpos",
	"regroup",
	"followme",
	"takingfire"
}

new cmd_radio2[6][] =
{
	"go",
	"fallback",
	"sticktog",
	"getinpos",
	"stormfront",
	"report"
}

new cmd_radio3[9][] =
{
	"roger",
	"enemyspot",
	"needbackup",
	"sectorclear",
	"inposition",
	"reportingin",
	"getout",
	"negative",
	"enemydown"
}

public komenda(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	new komenda[16]
	read_argv ( 0, komenda, 15 )
	
	for(new i = 0; i < 6; i++)
	{
		if(equal(komenda, cmd_radio1[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio1_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio1_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message1[64]
		
				switch(i)
				{
					case 0: { // 1
					message1 = CRcoverme	
					}
					case 1: { // 2
					message1 = CRtakepoint
					}
					case 2: { // 3
					message1 = CRhposition
					}
					case 3: { // 4
					message1 = CRregroup
					}
					case 4: { // 5
					message1 = CRfollowme
					}
					case 5: { // 6
					message1 = CRfireassis
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message1)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
		
		if(equal(komenda, cmd_radio2[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio2_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio2_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message2[64]
		
				switch(i)
				{
					case 0: { // 1
					message2 = CRgo	
					}
					case 1: { // 2
					message2 = CRfallback
					}
					case 2: { // 3
					message2 = CRsticktog
					}
					case 3: { // 4
					message2 = CRgetinpos
					}
					case 4: { // 5
					message2 = CRstormfront
					}
					case 5: { // 6
					message2 = CRreportin
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message2)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	for(new i = 0; i < 9; i++)
	{
		if(equal(komenda, cmd_radio3[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio3_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio3_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message3[64]
		
				switch(i)
				{
					case 0: { // 1
					message3 = CRroger	
					}
					case 1: { // 2
					message3 = CRenemys
					}
					case 2: { // 3
					message3 = CRbackup
					}
					case 3: { // 4
					message3 = CRclear
					}
					case 4: { // 5
					message3 = CRposition
					}
					case 5: { // 6
					message3 = CRreportingin
					}
					case 6: { // 7
					message3 = CRgetoutblow
					}
					case 7: { // 8
					message3 = CRnegative
					}
					case 8: { // 9
					message3 = CRenemydown
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message3)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	return PLUGIN_CONTINUE
}

Re: Radio Commands

Posted: 11 Aug 2017, 16:54
by Night Fury

Code: Select all

#include <zombie_escape>

/* CONFIG SETUP */
new CRcoverme[64], CRtakepoint[64], CRhposition[64], CRregroup[64], CRfollowme[64], CRfireassis[64], CRcolortitle[2], CRcolormenu[2],
CRgo[64], CRfallback[64], CRsticktog[64], CRgetinpos[64], CRstormfront[64], CRreportin[64], CRexit[64], g_RadioTimer[33], CRfireinhole[64]
CRroger[64], CRenemys[64], CRbackup[64], CRclear[64], CRposition[64], CRreportingin[64], CRgetoutblow[64], CRnegative[64], CRenemydown[64]

// Radio1 wav files 
stock const radio1_spk[6][] =
{   
	"radio/ze_radio/ct_coverme.wav", 
	"radio/ze_radio/takepoint.wav", 
	"radio/ze_radio/position.wav", 
	"radio/ze_radio/regroup.wav", 
	"radio/ze_radio/followme.wav", 
	"radio/ze_radio/fireassis.wav" 
} 

// Client used Radio1 commands
public radio1(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if(is_user_alive(id) == 0)
		return PLUGIN_CONTINUE
		
	// What Radio1 menu will look like
	new key1 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body1[512]
	new len1 = format(menu_body1, charsmax(menu_body1),"\%sRadio Commands A\%s^n\ ", CRcolortitle, CRcolormenu)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "^n\ ")
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "1. %s^n\ ", CRcoverme)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "2. %s^n\ ", CRtakepoint)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "3. %s^n\ ", CRhposition)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "4. %s^n\ ", CRregroup)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "5. %s^n\ ", CRfollowme)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "6. %s^n\ ", CRfireassis)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "^n\ " )
	len1 += format(menu_body1[len1], charsmax(menu_body1) -l en1, "0. %s", CRexit)
	show_menu(id, key1, menu_body1) // Show the above menu on screen 
	return PLUGIN_HANDLED 
} 

public radio1cmd(id, key1)
{ 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if (ze_is_user_zombie(id))
		return PLUGIN_HANDLED
		
	if(is_user_alive(id) == 0)
		return PLUGIN_CONTINUE
		
	if(g_RadioTimer[id] == 1)
		return PLUGIN_HANDLED
		
	new players[32], total, team_name[10] 
	get_user_team(id, team_name, charsmax(team_name)) 
	get_players(players, total, "ce", team_name)	// No bots and Match team name
	new name[32]
	get_user_name(id, name, charsmax(name))
	for(new a = 1;a <= total; ++a)
	{ 
		client_cmd(players[a], "spk ^"%s^"", radio1_spk[key1])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio1_spk[key1] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players[a],print_chat,"%s (RADIO): %s",name, radio1_say[key1])
		new message1[64]
		
		switch (key1)
		{
			case 0: { // 1
			message1 = CRcoverme	
			}
			case 1: { // 2
			message1 = CRtakepoint
			}
			case 2: { // 3
			message1 = CRhposition
			}
			case 3: { // 4
			message1 = CRregroup
			}
			case 4: { // 5
			message1 = CRfollowme
			}
			case 5: { // 6
			message1 = CRfireassis
			}
		}
		client_print(players[a], print_chat, "%s (RADIO): %s", name, message1)
		g_RadioTimer[id] = 1
		set_task(2.0, "radiotimer", id)
	}
	return PLUGIN_HANDLED 
} 



// Radio2 wav files 

stock const radio2_spk[6][] = 
{	
	"radio/ze_radio/com_go.wav", 
	"radio/ze_radio/fallback.wav", 
	"radio/ze_radio/sticktog.wav", 
	"radio/ze_radio/com_getinpos.wav", 
	"radio/ze_radio/stormfront.wav", 
	"radio/ze_radio/com_reportin.wav"
} 

public radio2(id) {   // Client used Radio2 commands 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	// What Radio2 menu will look like
	new key2 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body2[512]
	new len2 = format(menu_body2,511,"\%sRadio Commands B\%s^n\ ", CRcolortitle, CRcolormenu)
	len2 += format( menu_body2[len2], 511-len2, "^n\ " )
	len2 += format( menu_body2[len2], 511-len2, "1. %s^n\ ", CRgo)
	len2 += format( menu_body2[len2], 511-len2, "2. %s^n\ ", CRfallback)
	len2 += format( menu_body2[len2], 511-len2, "3. %s^n\ ", CRsticktog)
	len2 += format( menu_body2[len2], 511-len2, "4. %s^n\ ", CRgetinpos)
	len2 += format( menu_body2[len2], 511-len2, "5. %s^n\ ", CRstormfront)
	len2 += format( menu_body2[len2], 511-len2, "6. %s^n\ ", CRreportin)
	len2 += format( menu_body2[len2], 511-len2, "^n\ " )
	len2 += format( menu_body2[len2], 511-len2, "0. %s", CRexit)
	
	show_menu(id,key2,menu_body2) // Show the above menu on screen 
	return PLUGIN_HANDLED 
}

public radio2cmd(id, key2) { 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	if(g_RadioTimer[id] == 1) return PLUGIN_HANDLED
	new players2[32],total2, team_name2[10] 
	get_user_team(id,team_name2, 9) 
	get_players(players2, total2 ,"ce", team_name2) // No bots and Match team name
	new name2[32]
	get_user_name(id,name2,31)
	for(new a2=0; a2 < total2; ++a2) { 
		client_cmd(players2[a2], "spk ^"%s^"", radio2_spk[key2])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio2_spk[key2] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players2[a2],print_chat,"%s (RADIO): %s",name2,radio2_say[key2]) // Print radio message on screen
		new message2[64]
		
		switch (key2) {
			case 0: { // 1
			message2 = CRgo	
			}
			case 1: { // 2
			message2 = CRfallback
			}
			case 2: { // 3
			message2 = CRsticktog
			}
			case 3: { // 4
			message2 = CRgetinpos
			}
			case 4: { // 5
			message2 = CRstormfront
			}
			case 5: { // 6
			message2 = CRreportin
			}
		}
		client_print(players2[a2],print_chat,"%s (RADIO): %s",name2, message2)
		g_RadioTimer[id] = 1
		set_task(2.0,"radiotimer",id)
	}
	return PLUGIN_HANDLED 
} 


// Radio3 wav files 

stock const radio3_spk[9][] =  {   
	
	
	"radio/ze_radio/roger.wav", 
	"radio/ze_radio/ct_enemys.wav", 
	"radio/ze_radio/ct_backup.wav", 
	"radio/ze_radio/clear.wav", 
	"radio/ze_radio/ct_inpos.wav", 
	"radio/ze_radio/ct_reportingin.wav", 
	"radio/ze_radio/blow.wav", 
	"radio/ze_radio/negative.wav", 
	"radio/ze_radio/enemydown.wav" 
} 

public radio3(id) {   // Client used Radio3 commands 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	// What Radio3 menu will look like
	new key3 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
	
	new menu_body3[512]
	new len3 = format(menu_body3,511,"\%sRadio Commands C\%s^n\ ", CRcolortitle, CRcolormenu)
	len3 += format( menu_body3[len3], 511-len3, "^n\ " )
	len3 += format( menu_body3[len3], 511-len3, "1. %s^n\ ", CRroger)
	len3 += format( menu_body3[len3], 511-len3, "2. %s^n\ ", CRenemys)
	len3 += format( menu_body3[len3], 511-len3, "3. %s^n\ ", CRbackup)
	len3 += format( menu_body3[len3], 511-len3, "4. %s^n\ ", CRclear)
	len3 += format( menu_body3[len3], 511-len3, "5. %s^n\ ", CRposition)
	len3 += format( menu_body3[len3], 511-len3, "6. %s^n\ ", CRreportingin)
	len3 += format( menu_body3[len3], 511-len3, "7. %s^n\ ", CRgetoutblow)
	len3 += format( menu_body3[len3], 511-len3, "8. %s^n\ ", CRnegative)
	len3 += format( menu_body3[len3], 511-len3, "9. %s^n\ ", CRenemydown)
	len3 += format( menu_body3[len3], 511-len3, "^n\ " )
	len3 += format( menu_body3[len3], 511-len3, "0. %s", CRexit)
	
	show_menu(id,key3,menu_body3) // Show the above menu on screen 
	return PLUGIN_HANDLED 
} 

public radio3cmd(id, key3) { 
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(is_user_alive(id) == 0) return PLUGIN_HANDLED
	if(g_RadioTimer[id] == 1) return PLUGIN_HANDLED
	new players3[32],total3, team_name3[10] 
	get_user_team(id,team_name3, 9) 
	get_players(players3, total3 ,"ce", team_name3) // No bots and Match team name
	new name3[32]
	get_user_name(id,name3,31)
	for(new a3=0; a3 < total3; ++a3) { 
		client_cmd(players3[a3], "spk ^"%s^"", radio3_spk[key3])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio3_spk[key3] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		//client_print(players3[a3],print_chat,"%s (RADIO): %s",name3,radio3_say[key3]) // Print radio message on screen
		new message3[64]
		
		switch (key3) {
			case 0: { // 1
			message3 = CRroger	
			}
			case 1: { // 2
			message3 = CRenemys
			}
			case 2: { // 3
			message3 = CRbackup
			}
			case 3: { // 4
			message3 = CRclear
			}
			case 4: { // 5
			message3 = CRposition
			}
			case 5: { // 6
			message3 = CRreportingin
			}
			case 6: { // 7
			message3 = CRgetoutblow
			}
			case 7: { // 8
			message3 = CRnegative
			}
			case 8: { // 9
			message3 = CRenemydown
			}
		}
		client_print(players3[a3],print_chat,"%s (RADIO): %s",name3, message3)
		
		g_RadioTimer[id] = 1
		set_task(2.0,"radiotimer",id)
	}
	return PLUGIN_HANDLED 
} 


public plugin_precache() {
	
	precache_sound(radio1_spk[0])
	precache_sound(radio1_spk[1])
	precache_sound(radio1_spk[2])
	precache_sound(radio1_spk[3])
	precache_sound(radio1_spk[4])
	precache_sound(radio1_spk[5])
		
	precache_sound(radio2_spk[0])
	precache_sound(radio2_spk[1])
	precache_sound(radio2_spk[2])
	precache_sound(radio2_spk[3])
	precache_sound(radio2_spk[4])
	precache_sound(radio2_spk[5])
	
	precache_sound(radio3_spk[0])
	precache_sound(radio3_spk[1])
	precache_sound(radio3_spk[2])
	precache_sound(radio3_spk[3])
	precache_sound(radio3_spk[4])
	precache_sound(radio3_spk[5])
	precache_sound(radio3_spk[6])
	precache_sound(radio3_spk[7])
	precache_sound(radio3_spk[8])
	
	precache_sound("radio/custom/ct_fireinhole.wav")
	
	return PLUGIN_CONTINUE 
} 

public plugin_init(){
	
	register_plugin("Custom Radio Commands", "0.6", "KaLoSZyFeR")
	
	register_clcmd("radio1", "radio1", 0, "- Calls radio menu 1")
	register_clcmd("radio2", "radio2", 0, "- Calls radio menu 2")
	register_clcmd("radio3", "radio3", 0, "- Calls radio menu 3")
	register_menucmd(register_menuid("Radio Commands A"),511,"radio1cmd")
	register_menucmd(register_menuid("Radio Commands B"),511,"radio2cmd")
	register_menucmd(register_menuid("Radio Commands C"),511,"radio3cmd")

	register_cvar("amx_custom_radio", "1")
	register_cvar("amx_real_radio", "1")
	register_cvar("amx_radio_info", "1")
	
	register_cvar("CRcoverme", "radio")
	register_cvar("CRtakepoint", "radio")
	register_cvar("CRhposition", "radio")
	register_cvar("CRregroup", "radio")
	register_cvar("CRfollowme", "radio")
	register_cvar("CRfireassis", "radio")
	
	register_cvar("CRgo", "radio")
	register_cvar("CRfallback", "radio")
	register_cvar("CRsticktog", "radio")
	register_cvar("CRgetinpos", "radio")
	register_cvar("CRstormfront", "radio")
	register_cvar("CRreportin", "radio")

	register_cvar("CRroger", "radio")
	register_cvar("CRenemys", "radio")
	register_cvar("CRbackup", "radio")
	register_cvar("CRclear", "radio")
	register_cvar("CRposition", "radio")
	register_cvar("CRreportingin", "radio")
	register_cvar("CRgetoutblow", "radio")
	register_cvar("CRnegative", "radio")
	register_cvar("CRenemydown", "radio")
	
	register_cvar("CRexit", "radio")
	register_cvar("CRcolortitle", "r")
	register_cvar("CRcolormenu", "w")
	
	register_cvar("CRfireinhole", "radio")
		
	register_message(get_user_msgid("TextMsg"), "message")
	register_message(get_user_msgid("SendAudio"), "msg_audio")
	
	//version 0.6
	register_clcmd("coverme", "komenda", 0, "- Quick radio command")
	register_clcmd("takepoint", "komenda", 0, "- Quick radio command")
	register_clcmd("holdpos", "komenda", 0, "- Quick radio command")
	register_clcmd("regroup", "komenda", 0, "- Quick radio command")
	register_clcmd("followme", "komenda", 0, "- Quick radio command")
	register_clcmd("takingfire", "komenda", 0, "- Quick radio command")
	
	register_clcmd("go", "komenda", 0, "- Quick radio command")
	register_clcmd("fallback", "komenda", 0, "- Quick radio command")
	register_clcmd("sticktog", "komenda", 0, "- Quick radio command")
	register_clcmd("getinpos", "komenda", 0, "- Quick radio command")
	register_clcmd("stormfront", "komenda", 0, "- Quick radio command")
	register_clcmd("report", "komenda", 0, "- Quick radio command")
	
	register_clcmd("roger", "komenda", 0, "- Quick radio command")
	register_clcmd("enemyspot", "komenda", 0, "- Quick radio command")
	register_clcmd("needbackup", "komenda", 0, "- Quick radio command")
	register_clcmd("sectorclear", "komenda", 0, "- Quick radio command")
	register_clcmd("inposition", "komenda", 0, "- Quick radio command")
	register_clcmd("reportingin", "komenda", 0, "- Quick radio command")
	register_clcmd("getout", "komenda", 0, "- Quick radio command")
	register_clcmd("negative", "komenda", 0, "- Quick radio command")
	register_clcmd("enemydown", "komenda", 0, "- Quick radio command")

	new configsDir[64]
	get_configsdir(configsDir, 63)
	
	server_cmd("exec %s/custom_radio.cfg", configsDir)
	server_exec()
				
	return PLUGIN_CONTINUE  
}

public message()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE

	if(get_msg_args() != 4 || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(4) != ARG_STRING)
	{
		return PLUGIN_CONTINUE
	}

	new arg2[16]
	get_msg_arg_string(2, arg2, 15)
	if(!equal(arg2, "#Game_radio"))
	{
		return PLUGIN_CONTINUE
	}
	
	new arg4[20]
	get_msg_arg_string(4, arg4, 19)
	if(equal(arg4, "#Fire_in_the_hole"))
	{
		set_msg_arg_string(4, CRfireinhole)
		return PLUGIN_CONTINUE
	}
	
	return PLUGIN_CONTINUE
}

public msg_audio()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING) {
		return PLUGIN_CONTINUE
	}

	new arg2[20]
	get_msg_arg_string(2, arg2, 19)
	if(equal(arg2[1], "!MRAD_FIREINHOLE"))
	{
			return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public grenade_throw(id,ent,wid)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	new players[32],total, team_name[10] 
	get_user_team(id,team_name, 9) 
	get_players(players, total ,"ce", team_name) // No bots and Match team name
	new name[32]
	get_user_name(id,name,31)
	for(new a=0; a < total; ++a)
	{ 
		client_cmd(players[a], "spk radio/custom/ct_fireinhole.wav")
		if (get_cvar_num("amx_real_radio"))  
		{
		emit_sound(id, CHAN_VOICE, "radio/custom/ct_fireinhole.wav" , 0.9, ATTN_STATIC, 0, PITCH_NORM)  
		}
	}
	return PLUGIN_HANDLED
}
	
public radiotimer(id) {
	g_RadioTimer[id] = 0
	return PLUGIN_HANDLED
}

public client_connect(id) {
	g_RadioTimer[id] = 0
}

public client_disconnect(id) {
	g_RadioTimer[id] = 0
}


public client_putinserver(id)	
{
	set_task(20.0, "dispInfo", id)
}

public dispInfo(id)
{
	if (get_cvar_num("amx_radio_info")) 
		//client_print(id,print_chat,"Plugin 'Custom Radio Commands' jest uruchomiony na tym serwerze. Kontakt z autorem: kaloszyfer@o2.pl")
		client_print(id,print_chat,"'Custom Radio Commands' plugin is running on this server. Contact with author: kaloszyfer@o2.pl")
}

public plugin_cfg()
{

	get_cvar_string("CRcoverme", CRcoverme, 63)
	get_cvar_string("CRtakepoint", CRtakepoint, 63)
	get_cvar_string("CRhposition", CRhposition, 63)
	get_cvar_string("CRregroup", CRregroup, 63)
	get_cvar_string("CRfollowme", CRfollowme, 63)
	get_cvar_string("CRfireassis", CRfireassis, 63)

	get_cvar_string("CRgo", CRgo, 63)
	get_cvar_string("CRfallback", CRfallback, 63)
	get_cvar_string("CRsticktog", CRsticktog, 63)
	get_cvar_string("CRgetinpos", CRgetinpos, 63)
	get_cvar_string("CRstormfront", CRstormfront, 63)
	get_cvar_string("CRreportin", CRreportin, 63)
	
	get_cvar_string("CRroger", CRroger, 63)
	get_cvar_string("CRenemys", CRenemys, 63)
	get_cvar_string("CRbackup", CRbackup, 63)
	get_cvar_string("CRclear", CRclear, 63)
	get_cvar_string("CRposition", CRposition, 63)
	get_cvar_string("CRreportingin", CRreportingin, 63)
	get_cvar_string("CRgetoutblow", CRgetoutblow, 63)
	get_cvar_string("CRnegative", CRnegative, 63)
	get_cvar_string("CRenemydown", CRenemydown, 63)
	
	get_cvar_string("CRexit", CRexit, 63)
	get_cvar_string("CRcolortitle", CRcolortitle, 1)
	get_cvar_string("CRcolormenu", CRcolormenu, 1)
	
	//version 0.6
	get_cvar_string("CRfireinhole", CRfireinhole, 63)
	
}

//version 0.6
new cmd_radio1[6][] =
{
	"coverme",
	"takepoint",
	"holdpos",
	"regroup",
	"followme",
	"takingfire"
}

new cmd_radio2[6][] =
{
	"go",
	"fallback",
	"sticktog",
	"getinpos",
	"stormfront",
	"report"
}

new cmd_radio3[9][] =
{
	"roger",
	"enemyspot",
	"needbackup",
	"sectorclear",
	"inposition",
	"reportingin",
	"getout",
	"negative",
	"enemydown"
}

public komenda(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_CONTINUE
		
	new komenda[16]
	read_argv ( 0, komenda, 15 )
	
	for(new i = 0; i < 6; i++)
	{
		if(equal(komenda, cmd_radio1[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio1_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio1_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message1[64]
		
				switch(i)
				{
					case 0: { // 1
					message1 = CRcoverme	
					}
					case 1: { // 2
					message1 = CRtakepoint
					}
					case 2: { // 3
					message1 = CRhposition
					}
					case 3: { // 4
					message1 = CRregroup
					}
					case 4: { // 5
					message1 = CRfollowme
					}
					case 5: { // 6
					message1 = CRfireassis
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message1)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
		
		if(equal(komenda, cmd_radio2[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio2_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio2_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message2[64]
		
				switch(i)
				{
					case 0: { // 1
					message2 = CRgo	
					}
					case 1: { // 2
					message2 = CRfallback
					}
					case 2: { // 3
					message2 = CRsticktog
					}
					case 3: { // 4
					message2 = CRgetinpos
					}
					case 4: { // 5
					message2 = CRstormfront
					}
					case 5: { // 6
					message2 = CRreportin
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message2)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	for(new i = 0; i < 9; i++)
	{
		if(equal(komenda, cmd_radio3[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio3_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio3_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message3[64]
		
				switch(i)
				{
					case 0: { // 1
					message3 = CRroger	
					}
					case 1: { // 2
					message3 = CRenemys
					}
					case 2: { // 3
					message3 = CRbackup
					}
					case 3: { // 4
					message3 = CRclear
					}
					case 4: { // 5
					message3 = CRposition
					}
					case 5: { // 6
					message3 = CRreportingin
					}
					case 6: { // 7
					message3 = CRgetoutblow
					}
					case 7: { // 8
					message3 = CRnegative
					}
					case 8: { // 9
					message3 = CRenemydown
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message3)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	return PLUGIN_CONTINUE
}

Re: Radio Commands

Posted: 11 Aug 2017, 22:44
by Spir0x
jack dude this code gives 5 erros u didn't try to compile? :) please look at this backweapons plugin code:

i added
if(is_user_alive(id)) && (ze_is_user_zombie(id))

Code: Select all

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombie_escape>

#define PLUGIN	"Back Weapons"
#define AUTHOR	"hoboman313/cheap_suit"
#define VERSION	"1.87"

#define MAX_PLAYERS 		32
#define OFFSET_PRIMARYWEAPON 	116
#define OFFSET_WEAPONTYPE 	43
#define EXTRAOFFSET_WEAPONS 	4
#define OFFSET_AUTOSWITCH 	509
#define OFFSET_SHIELD 		510
#define HAS_SHIELD 		(1<<24)

#define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 1<<CSW_FAMAS | 1<<CSW_AWP | 1<<CSW_MP5NAVY | 1<<CSW_M249 | 1<<CSW_M3 | 1<<CSW_M4A1 | 1<<CSW_TMP | 1<<CSW_G3SG1 | 1<<CSW_SG552 | 1<<CSW_AK47 | 1<<CSW_P90)

#define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))
#define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)
#define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)
#define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)
#define cs_get_user_shield(%1)	   (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

enum
{
	MODEL_NULL    = 0,
	MODEL_AUG     = 1,
	MODEL_AK47    = 2,
	MODEL_AWP     = 3,
	MODEL_MP5NAVY = 4,
	MODEL_P90     = 5,
	MODEL_GALIL   = 6,
	MODEL_M4A1    = 7,
	MODEL_SG550   = 8,
	MODEL_SG552   = 9,
	MODEL_SCOUT   = 10,
	MODEL_XM1014  = 11,
	MODEL_M3      = 12,
	MODEL_G3SG1   = 13,
	MODEL_M249    = 14,
	MODEL_FAMAS   = 15,
	MODEL_UMP45   = 16
}

new g_weapons[][] =
{	
	"weapon_p228",
	"weapon_scout",
	"weapon_hegrenade",
	"weapon_xm1014",
	"weapon_c4",
	"weapon_mac10",
	"weapon_aug",
	"weapon_smokegrenade",
	"weapon_elite",
	"weapon_fiveseven",
	"weapon_ump45",
	"weapon_sg550",
	"weapon_galil",
	"weapon_famas",
	"weapon_usp",
	"weapon_glock18",
	"weapon_awp",
	"weapon_mp5navy",
	"weapon_m249",
	"weapon_m3",
	"weapon_m4a1",
	"weapon_tmp",
	"weapon_g3sg1",
	"weapon_flashbang",
	"weapon_deagle",
	"weapon_sg552",
	"weapon_ak47",
	"weapon_knife",
	"weapon_p90"
}

new g_weaponclass[] = "backweapon"
new g_weaponmodel[] = "models/backweapons.mdl"

new g_weaponent[MAX_PLAYERS+1]

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)
	
	RegisterHam(Ham_Killed,           "player", "bacon_killed")
	RegisterHam(Ham_Spawn,            "player", "bacon_spawn_post", 1)
	RegisterHam(Ham_AddPlayerItem,    "player", "bacon_addplayeritem")
	RegisterHam(Ham_RemovePlayerItem, "player", "bacon_removeplayeritem")
	
	for(new i = 0; i < sizeof g_weapons; i++)
	{
		RegisterHam(Ham_Item_AttachToPlayer, g_weapons[i], "bacon_item_attachtoplayer_post", 1)
		RegisterHam(Ham_Item_Deploy,         g_weapons[i], "bacon_item_deploy_post",         1)
	}
}

public plugin_precache()
	precache_model(g_weaponmodel)

public client_putinserver(id)
{
	static infotarget 
	if(!infotarget) infotarget = engfunc(EngFunc_AllocString, "info_target")
	
	g_weaponent[id] = engfunc(EngFunc_CreateNamedEntity, infotarget)
	if(pev_valid(g_weaponent[id]))
	{
		engfunc(EngFunc_SetModel, g_weaponent[id], g_weaponmodel)
		set_pev(g_weaponent[id], pev_classname, g_weaponclass)
		set_pev(g_weaponent[id], pev_movetype, MOVETYPE_FOLLOW)
		set_pev(g_weaponent[id], pev_effects, EF_NODRAW)
		set_pev(g_weaponent[id], pev_aiment, id)
	}
}

public client_disconnect(id)
{
	if(g_weaponent[id] > 0 && pev_valid(g_weaponent[id]))
		engfunc(EngFunc_RemoveEntity, g_weaponent[id])
	
	g_weaponent[id] = 0
}

public bacon_killed(id, idattacker, shouldgib)
	fm_set_entity_visibility(g_weaponent[id], 0)

public bacon_addplayeritem(id, ent)
{
	static weaponid; weaponid = cs_get_weapon_type(ent)
	if(is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))
	{
		fm_set_entity_visibility(g_weaponent[id], 0)
		set_pev(g_weaponent[id], pev_body, get_weapon_model(weaponid))
	}
}

public bacon_removeplayeritem(id, ent)
{
	if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
		fm_set_entity_visibility(g_weaponent[id], 0)
}

public bacon_spawn_post(id) if(is_user_alive(id))
{
	if(!cs_get_user_hasprim(id))
		fm_set_entity_visibility(g_weaponent[id], 0)
}

public bacon_item_attachtoplayer_post(ent, id) if(is_user_alive(id) && !cs_get_user_autoswitch(id))
{
	if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
		fm_set_entity_visibility(g_weaponent[id], 1)
}

public bacon_item_deploy_post(ent)
{
	static id; id = pev(ent, pev_owner)
	if(is_user_alive(id)) && (ze_is_user_zombie(id))
	{
		static weapon; weapon = cs_get_weapon_type(ent)
		if(is_weapon_primary(weapon) || cs_get_user_shield(id))
			fm_set_entity_visibility(g_weaponent[id], 0)
		
		else if(cs_get_user_hasprim(id))
			fm_set_entity_visibility(g_weaponent[id], 1)
	}
}

stock get_weapon_model(weapon)
{
	switch(weapon)
	{
		case CSW_SCOUT:   return MODEL_SCOUT
		case CSW_XM1014:  return MODEL_XM1014
		case CSW_AUG:	  return MODEL_AUG
		case CSW_UMP45:   return MODEL_UMP45
		case CSW_SG550:   return MODEL_SG550
		case CSW_GALIL:   return MODEL_GALIL
		case CSW_FAMAS:   return MODEL_FAMAS
		case CSW_AWP:     return MODEL_AWP
		case CSW_MP5NAVY: return MODEL_MP5NAVY
		case CSW_M249:    return MODEL_M249
		case CSW_M3:      return MODEL_M3
		case CSW_M4A1:    return MODEL_M4A1
		case CSW_G3SG1:   return MODEL_G3SG1
		case CSW_SG552:   return MODEL_SG552
		case CSW_AK47:    return MODEL_AK47
		case CSW_P90:     return MODEL_P90
	}
	return 0
}

stock fm_set_entity_visibility(index, visible = 1) 
	set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

Re: Radio Commands

Posted: 12 Aug 2017, 04:01
by Night Fury

Code: Select all

#include <zombie_escape>

/* CONFIG SETUP */
new CRcoverme[64], CRtakepoint[64], CRhposition[64], CRregroup[64], CRfollowme[64], CRfireassis[64], CRcolortitle[2], CRcolormenu[2],
CRgo[64], CRfallback[64], CRsticktog[64], CRgetinpos[64], CRstormfront[64], CRreportin[64], CRexit[64], g_RadioTimer[33], CRfireinhole[64],
CRroger[64], CRenemys[64], CRbackup[64], CRclear[64], CRposition[64], CRreportingin[64], CRgetoutblow[64], CRnegative[64], CRenemydown[64]

// Radio1 wav files 
stock const radio1_spk[6][] =
{   
	"radio/ze_radio/ct_coverme.wav", 
	"radio/ze_radio/takepoint.wav", 
	"radio/ze_radio/position.wav", 
	"radio/ze_radio/regroup.wav", 
	"radio/ze_radio/followme.wav", 
	"radio/ze_radio/fireassis.wav" 
} 

// Client used Radio1 commands
public radio1(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if(is_user_alive(id) == 0)
		return PLUGIN_CONTINUE
		
	// What Radio1 menu will look like
	new key1 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body1[512]
	new len1 = format(menu_body1, charsmax(menu_body1),"\%sRadio Commands A\%s^n\ ", CRcolortitle, CRcolormenu)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "^n\ ")
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "1. %s^n\ ", CRcoverme)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "2. %s^n\ ", CRtakepoint)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "3. %s^n\ ", CRhposition)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "4. %s^n\ ", CRregroup)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "5. %s^n\ ", CRfollowme)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "6. %s^n\ ", CRfireassis)
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "^n\ " )
	len1 += format(menu_body1[len1], charsmax(menu_body1) - len1, "0. %s", CRexit)
	show_menu(id, key1, menu_body1) // Show the above menu on screen 
	return PLUGIN_HANDLED 
} 

public radio1cmd(id, key1)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	if(!get_cvar_num("amx_custom_radio") || ze_is_user_zombie(id) || g_RadioTimer[id] == 1)
		return PLUGIN_HANDLED
		
	new players[32], total, team_name[10], name[32], a, message1[64]
	
	get_user_team(id, team_name, charsmax(team_name)) 
	get_players(players, total, "ce", team_name)	// No bots and Match team name
	get_user_name(id, name, charsmax(name))
	
	for(a = 1;a <= total; ++a)
	{
		client_cmd(players[a], "spk ^"%s^"", radio1_spk[key1])
		
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio1_spk[key1], 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		
		switch (key1)
		{
			case 0:	message1 = CRcoverme
			case 1:	message1 = CRtakepoint
			case 2:	message1 = CRhposition
			case 3:	message1 = CRregroup
			case 4:	message1 = CRfollowme
			case 5:	message1 = CRfireassis
		}
		
		client_print(players[a], print_chat, "%s (RADIO): %s", name, message1)
		g_RadioTimer[id] = 1
		set_task(2.0, "radiotimer", id)
	}
	return PLUGIN_CONTINUE
} 



// Radio2 wav files 

stock const radio2_spk[6][] = 
{
	"radio/ze_radio/com_go.wav", 
	"radio/ze_radio/fallback.wav", 
	"radio/ze_radio/sticktog.wav", 
	"radio/ze_radio/com_getinpos.wav", 
	"radio/ze_radio/stormfront.wav", 
	"radio/ze_radio/com_reportin.wav"
} 

public radio2(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	// What Radio2 menu will look like
	new key2 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9)
		
	new menu_body2[512]
	new len2 = format(menu_body2,511,"\%sRadio Commands B\%s^n\ ", CRcolortitle, CRcolormenu)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "^n\ ")
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "1. %s^n\ ", CRgo)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "2. %s^n\ ", CRfallback)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "3. %s^n\ ", CRsticktog)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "4. %s^n\ ", CRgetinpos)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "5. %s^n\ ", CRstormfront)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "6. %s^n\ ", CRreportin)
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "^n\ ")
	len2 += format(menu_body2[len2], charsmax(menu_body2) - len2, "0. %s", CRexit)
	
	show_menu(id, key2 ,menu_body2) // Show the above menu on screen 
	return PLUGIN_CONTINUE
}

public radio2cmd(id, key2)
{ 
	if(!get_cvar_num("amx_custom_radio") || g_RadioTimer[id] == 1)
		return PLUGIN_HANDLED
		
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	new players2[32], total2, team_name2[10], name2[32], a2, message2[64]
	
	get_user_team(id, team_name2, charsmax(team_name2)) 
	get_players(players2, total2 ,"ce", team_name2) // No bots and Match team name
	get_user_name(id, name2,charsmax(name2))
	
	for(a2 = 1; a2 <= total2; ++a2)
	{ 
		client_cmd(players2[a2], "spk ^"%s^"", radio2_spk[key2])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio2_spk[key2], 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		
		switch (key2)
		{
			case 0:	message2 = CRgo
			case 1:	message2 = CRfallback
			case 2:	message2 = CRsticktog
			case 3:	message2 = CRgetinpos
			case 4:	message2 = CRstormfront
			case 5:	message2 = CRreportin
		}
		
		client_print(players2[a2], print_chat, "%s (RADIO): %s", name2, message2)
		g_RadioTimer[id] = 1
		set_task(2.0, "radiotimer", id)
	}
	return PLUGIN_CONTINUE 
} 


// Radio3 wav files 

stock const radio3_spk[9][] = 
{
	"radio/ze_radio/roger.wav", 
	"radio/ze_radio/ct_enemys.wav", 
	"radio/ze_radio/ct_backup.wav", 
	"radio/ze_radio/clear.wav", 
	"radio/ze_radio/ct_inpos.wav", 
	"radio/ze_radio/ct_reportingin.wav", 
	"radio/ze_radio/blow.wav", 
	"radio/ze_radio/negative.wav", 
	"radio/ze_radio/enemydown.wav" 
} 

public radio3(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	// What Radio3 menu will look like
	new key3 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
	
	new menu_body3[512]
	new len3 = format(menu_body3, charsmax(menu_body3) ,"\%sRadio Commands C\%s^n\ ", CRcolortitle, CRcolormenu)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "^n\ ")
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "1. %s^n\ ", CRroger)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "2. %s^n\ ", CRenemys)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "3. %s^n\ ", CRbackup)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "4. %s^n\ ", CRclear)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "5. %s^n\ ", CRposition)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "6. %s^n\ ", CRreportingin)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "7. %s^n\ ", CRgetoutblow)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "8. %s^n\ ", CRnegative)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "9. %s^n\ ", CRenemydown)
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "^n\ " )
	len3 += format(menu_body3[len3], charsmax(menu_body3) - len3, "0. %s", CRexit)
	
	show_menu(id, key3, menu_body3) // Show the above menu on screen 
	return PLUGIN_CONTINUE
} 

public radio3cmd(id, key3)
{ 
	if(!get_cvar_num("amx_custom_radio") || g_RadioTimer[id] == 1)
		return PLUGIN_HANDLED
		
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE
		
	new players3[32], total3, team_name3[10], name3[32], a3, message3[64]
	get_user_team(id, team_name3, charsmax(team_name3)) 
	get_players(players3, total3 ,"ce", team_name3) // No bots and Match team name
	get_user_name(id, name3, charsmax(name3))
	
	for(a3 = 1; a3 <= total3; ++a3)
	{ 
		client_cmd(players3[a3], "spk ^"%s^"", radio3_spk[key3])
		if (get_cvar_num("amx_real_radio"))
		{
			emit_sound(id, CHAN_VOICE, radio3_spk[key3], 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
		}
		
		switch (key3)
		{
			case 0:	message3 = CRroger
			case 1:	message3 = CRenemys
			case 2:	message3 = CRbackup
			case 3:	message3 = CRclear
			case 4:	message3 = CRposition
			case 5:	message3 = CRreportingin
			case 6:	message3 = CRgetoutblow
			case 7:	message3 = CRnegative
			case 8:	message3 = CRenemydown
		}
		client_print(players3[a3], print_chat, "%s (RADIO): %s", name3, message3)
		g_RadioTimer[id] = 1
		set_task(2.0, "radiotimer", id)
	}
	return PLUGIN_CONTINUE
} 


public plugin_precache()
{
	precache_sound(radio1_spk[0])
	precache_sound(radio1_spk[1])
	precache_sound(radio1_spk[2])
	precache_sound(radio1_spk[3])
	precache_sound(radio1_spk[4])
	precache_sound(radio1_spk[5])
		
	precache_sound(radio2_spk[0])
	precache_sound(radio2_spk[1])
	precache_sound(radio2_spk[2])
	precache_sound(radio2_spk[3])
	precache_sound(radio2_spk[4])
	precache_sound(radio2_spk[5])
	
	precache_sound(radio3_spk[0])
	precache_sound(radio3_spk[1])
	precache_sound(radio3_spk[2])
	precache_sound(radio3_spk[3])
	precache_sound(radio3_spk[4])
	precache_sound(radio3_spk[5])
	precache_sound(radio3_spk[6])
	precache_sound(radio3_spk[7])
	precache_sound(radio3_spk[8])
	
	precache_sound("radio/custom/ct_fireinhole.wav")
} 

public plugin_init()
{
	register_plugin("Custom Radio Commands", "0.6", "KaLoSZyFeR")
	
	register_clcmd("radio1", "radio1", 0, "- Calls radio menu 1")
	register_clcmd("radio2", "radio2", 0, "- Calls radio menu 2")
	register_clcmd("radio3", "radio3", 0, "- Calls radio menu 3")
	
	register_menucmd(register_menuid("Radio Commands A"), 511, "radio1cmd")
	register_menucmd(register_menuid("Radio Commands B"), 511, "radio2cmd")
	register_menucmd(register_menuid("Radio Commands C"), 511, "radio3cmd")

	register_cvar("amx_custom_radio", "1")
	register_cvar("amx_real_radio", "1")
	register_cvar("amx_radio_info", "1")
	
	register_cvar("CRcoverme", "radio")
	register_cvar("CRtakepoint", "radio")
	register_cvar("CRhposition", "radio")
	register_cvar("CRregroup", "radio")
	register_cvar("CRfollowme", "radio")
	register_cvar("CRfireassis", "radio")
	
	register_cvar("CRgo", "radio")
	register_cvar("CRfallback", "radio")
	register_cvar("CRsticktog", "radio")
	register_cvar("CRgetinpos", "radio")
	register_cvar("CRstormfront", "radio")
	register_cvar("CRreportin", "radio")

	register_cvar("CRroger", "radio")
	register_cvar("CRenemys", "radio")
	register_cvar("CRbackup", "radio")
	register_cvar("CRclear", "radio")
	register_cvar("CRposition", "radio")
	register_cvar("CRreportingin", "radio")
	register_cvar("CRgetoutblow", "radio")
	register_cvar("CRnegative", "radio")
	register_cvar("CRenemydown", "radio")
	
	register_cvar("CRexit", "radio")
	register_cvar("CRcolortitle", "r")
	register_cvar("CRcolormenu", "w")
	
	register_cvar("CRfireinhole", "radio")
		
	register_message(get_user_msgid("TextMsg"), "message")
	register_message(get_user_msgid("SendAudio"), "msg_audio")
	
	//version 0.6
	register_clcmd("coverme", "komenda", 0, "- Quick radio command")
	register_clcmd("takepoint", "komenda", 0, "- Quick radio command")
	register_clcmd("holdpos", "komenda", 0, "- Quick radio command")
	register_clcmd("regroup", "komenda", 0, "- Quick radio command")
	register_clcmd("followme", "komenda", 0, "- Quick radio command")
	register_clcmd("takingfire", "komenda", 0, "- Quick radio command")
	
	register_clcmd("go", "komenda", 0, "- Quick radio command")
	register_clcmd("fallback", "komenda", 0, "- Quick radio command")
	register_clcmd("sticktog", "komenda", 0, "- Quick radio command")
	register_clcmd("getinpos", "komenda", 0, "- Quick radio command")
	register_clcmd("stormfront", "komenda", 0, "- Quick radio command")
	register_clcmd("report", "komenda", 0, "- Quick radio command")
	
	register_clcmd("roger", "komenda", 0, "- Quick radio command")
	register_clcmd("enemyspot", "komenda", 0, "- Quick radio command")
	register_clcmd("needbackup", "komenda", 0, "- Quick radio command")
	register_clcmd("sectorclear", "komenda", 0, "- Quick radio command")
	register_clcmd("inposition", "komenda", 0, "- Quick radio command")
	register_clcmd("reportingin", "komenda", 0, "- Quick radio command")
	register_clcmd("getout", "komenda", 0, "- Quick radio command")
	register_clcmd("negative", "komenda", 0, "- Quick radio command")
	register_clcmd("enemydown", "komenda", 0, "- Quick radio command")

	new configsDir[64]
	get_configsdir(configsDir, charsmax(configsDir))
	
	server_cmd("exec %s/custom_radio.cfg", configsDir)
	server_exec() 
}

public message()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED

	if(get_msg_args() != 4 || get_msg_argtype(2) != ARG_STRING || get_msg_argtype(4) != ARG_STRING)
		return PLUGIN_CONTINUE

	new arg2[16]
	get_msg_arg_string(2, arg2, charsmax(arg2))
	if(!equal(arg2, "#Game_radio"))
		return PLUGIN_CONTINUE
	
	new arg4[20]
	get_msg_arg_string(4, arg4, charsmax(arg4))
	if(equal(arg4, "#Fire_in_the_hole"))
	{
		set_msg_arg_string(4, CRfireinhole)
		return PLUGIN_CONTINUE
	}
	
	return PLUGIN_CONTINUE
}

public msg_audio()
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	if(get_msg_args() != 3 || get_msg_argtype(2) != ARG_STRING)
		return PLUGIN_CONTINUE

	new arg2[20]
	get_msg_arg_string(2, arg2, charsmax(arg2))
	if(equal(arg2[1], "!MRAD_FIREINHOLE"))
		return PLUGIN_HANDLED
	
	return PLUGIN_CONTINUE
}

public grenade_throw(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return
		
	new players[32], total, team_name[10], name[32], a
	get_user_team(id, team_name, charsmax(team_name)) 
	get_players(players, total ,"ce", team_name) // No bots and Match team name
	get_user_name(id, name, charsmax(name))
	
	for(a = 1; a <= total; ++a)
	{ 
		client_cmd(players[a], "spk radio/custom/ct_fireinhole.wav")
		if (get_cvar_num("amx_real_radio"))  
		{
			emit_sound(id, CHAN_VOICE, "radio/custom/ct_fireinhole.wav" , 0.9, ATTN_STATIC, 0, PITCH_NORM)  
		}
	}
}
	
public radiotimer(id)
{
	g_RadioTimer[id] = 0
}

public client_connect(id)
{
	g_RadioTimer[id] = 0
}

public client_disconnected(id)
{
	g_RadioTimer[id] = 0
}

public client_putinserver(id)	
{
	set_task(20.0, "dispInfo", id)
}

public dispInfo(id)
{
	if (get_cvar_num("amx_radio_info")) 
		client_print(id,print_chat,"'Custom Radio Commands' plugin is running on this server.")
}

public plugin_cfg()
{
	get_cvar_string("CRcoverme", CRcoverme, charsmax(CRcoverme))
	get_cvar_string("CRtakepoint", CRtakepoint, charsmax(CRtakepoint))
	get_cvar_string("CRhposition", CRhposition, charsmax(CRhposition))
	get_cvar_string("CRregroup", CRregroup, charsmax(CRregroup))
	get_cvar_string("CRfollowme", CRfollowme, charsmax(CRfollowme))
	get_cvar_string("CRfireassis", CRfireassis, charsmax(CRfireassis))

	get_cvar_string("CRgo", CRgo, charsmax(CRgo))
	get_cvar_string("CRfallback", CRfallback, charsmax(CRfallback))
	get_cvar_string("CRsticktog", CRsticktog, charsmax(CRsticktog))
	get_cvar_string("CRgetinpos", CRgetinpos, charsmax(CRgetinpos))
	get_cvar_string("CRstormfront", CRstormfront, charsmax(CRstormfront))
	get_cvar_string("CRreportin", CRreportin, charsmax(CRreportin))
	
	get_cvar_string("CRroger", CRroger, charsmax(CRroger))
	get_cvar_string("CRenemys", CRenemys, charsmax(CRenemys))
	get_cvar_string("CRbackup", CRbackup, charsmax(CRbackup))
	get_cvar_string("CRclear", CRclear, charsmax(CRclear))
	get_cvar_string("CRposition", CRposition, charsmax(CRposition))
	get_cvar_string("CRreportingin", CRreportingin, charsmax(CRreportingin))
	get_cvar_string("CRgetoutblow", CRgetoutblow, charsmax(CRgetoutblow))
	get_cvar_string("CRnegative", CRnegative, charsmax(CRnegative))
	get_cvar_string("CRenemydown", CRenemydown, charsmax(CRenemydown))
	
	get_cvar_string("CRexit", CRexit, charsmax(CRexit))
	get_cvar_string("CRcolortitle", CRcolortitle, charsmax(CRcolortitle))
	get_cvar_string("CRcolormenu", CRcolormenu, charsmax(CRcolormenu))
	
	get_cvar_string("CRfireinhole", CRfireinhole, charsmax(CRfireinhole))
	
}

new cmd_radio1[6][] =
{
	"coverme",
	"takepoint",
	"holdpos",
	"regroup",
	"followme",
	"takingfire"
}

new cmd_radio2[6][] =
{
	"go",
	"fallback",
	"sticktog",
	"getinpos",
	"stormfront",
	"report"
}

new cmd_radio3[9][] =
{
	"roger",
	"enemyspot",
	"needbackup",
	"sectorclear",
	"inposition",
	"reportingin",
	"getout",
	"negative",
	"enemydown"
}

public komenda(id)
{
	if(!get_cvar_num("amx_custom_radio"))
		return PLUGIN_HANDLED
		
	new komenda[16], i
	read_argv(0, komenda, charsmax(komenda))
	
	for(i = 1; i <= 6; i++)
	{
		if(equal(komenda, cmd_radio1[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio1_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio1_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message1[64]
		
				switch(i)
				{
					case 0: { // 1
					message1 = CRcoverme	
					}
					case 1: { // 2
					message1 = CRtakepoint
					}
					case 2: { // 3
					message1 = CRhposition
					}
					case 3: { // 4
					message1 = CRregroup
					}
					case 4: { // 5
					message1 = CRfollowme
					}
					case 5: { // 6
					message1 = CRfireassis
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message1)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
		else if(equal(komenda, cmd_radio2[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio2_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio2_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message2[64]
		
				switch(i)
				{
					case 0: { // 1
					message2 = CRgo	
					}
					case 1: { // 2
					message2 = CRfallback
					}
					case 2: { // 3
					message2 = CRsticktog
					}
					case 3: { // 4
					message2 = CRgetinpos
					}
					case 4: { // 5
					message2 = CRstormfront
					}
					case 5: { // 6
					message2 = CRreportin
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message2)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	for(i = 1; i <= 9; i++)
	{
		if(equal(komenda, cmd_radio3[i]))
		{
			if(is_user_alive(id) == 0)
				return PLUGIN_HANDLED
			if(g_RadioTimer[id] == 1) 
				return PLUGIN_HANDLED
		
			new players[32],total, team_name[10] 
			get_user_team(id,team_name, 9) 
			get_players(players, total ,"ce", team_name) // No bots and Match team name
			new name[32]
			get_user_name(id,name,31)
			for(new a=0; a < total; ++a)
			{ 
				client_cmd(players[a], "spk ^"%s^"", radio3_spk[i])
				if (get_cvar_num("amx_real_radio"))
				{
					emit_sound(id, CHAN_VOICE, radio3_spk[i] , 0.9, ATTN_STATIC, 0, PITCH_NORM)// Play sounds 
				}
				new message3[64]
		
				switch(i)
				{
					case 0: { // 1
					message3 = CRroger	
					}
					case 1: { // 2
					message3 = CRenemys
					}
					case 2: { // 3
					message3 = CRbackup
					}
					case 3: { // 4
					message3 = CRclear
					}
					case 4: { // 5
					message3 = CRposition
					}
					case 5: { // 6
					message3 = CRreportingin
					}
					case 6: { // 7
					message3 = CRgetoutblow
					}
					case 7: { // 8
					message3 = CRnegative
					}
					case 8: { // 9
					message3 = CRenemydown
					}
				}
				client_print(players[a],print_chat,"%s (RADIO): %s",name, message3)
				g_RadioTimer[id] = 1
				set_task(2.0,"radiotimer",id)
			}
			return PLUGIN_HANDLED
		}
	}
	
	return PLUGIN_CONTINUE
}

Code: Select all

#include <zombie_escape>

#define OFFSET_PRIMARYWEAPON 	116
#define OFFSET_WEAPONTYPE 	43
#define EXTRAOFFSET_WEAPONS 	4
#define OFFSET_AUTOSWITCH 	509
#define OFFSET_SHIELD 		510
#define HAS_SHIELD 		(1<<24)

#define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 1<<CSW_FAMAS | 1<<CSW_AWP | 1<<CSW_MP5NAVY | 1<<CSW_M249 | 1<<CSW_M3 | 1<<CSW_M4A1 | 1<<CSW_TMP | 1<<CSW_G3SG1 | 1<<CSW_SG552 | 1<<CSW_AK47 | 1<<CSW_P90)

#define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))
#define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)
#define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)
#define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)
#define cs_get_user_shield(%1)	   (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

enum
{
	MODEL_NULL    = 0,
	MODEL_AUG     = 1,
	MODEL_AK47    = 2,
	MODEL_AWP     = 3,
	MODEL_MP5NAVY = 4,
	MODEL_P90     = 5,
	MODEL_GALIL   = 6,
	MODEL_M4A1    = 7,
	MODEL_SG550   = 8,
	MODEL_SG552   = 9,
	MODEL_SCOUT   = 10,
	MODEL_XM1014  = 11,
	MODEL_M3      = 12,
	MODEL_G3SG1   = 13,
	MODEL_M249    = 14,
	MODEL_FAMAS   = 15,
	MODEL_UMP45   = 16
}

new g_weapons[][] =
{	
	"weapon_p228",
	"weapon_scout",
	"weapon_hegrenade",
	"weapon_xm1014",
	"weapon_c4",
	"weapon_mac10",
	"weapon_aug",
	"weapon_smokegrenade",
	"weapon_elite",
	"weapon_fiveseven",
	"weapon_ump45",
	"weapon_sg550",
	"weapon_galil",
	"weapon_famas",
	"weapon_usp",
	"weapon_glock18",
	"weapon_awp",
	"weapon_mp5navy",
	"weapon_m249",
	"weapon_m3",
	"weapon_m4a1",
	"weapon_tmp",
	"weapon_g3sg1",
	"weapon_flashbang",
	"weapon_deagle",
	"weapon_sg552",
	"weapon_ak47",
	"weapon_knife",
	"weapon_p90"
}

new g_weaponclass[] = "backweapon"
new g_weaponmodel[] = "models/backweapons.mdl"

new g_weaponent[33]

public plugin_init() 
{
	register_plugin("Back Weapons", "1.87", "hoboman313/cheap_suit")
	
	RegisterHam(Ham_Killed, "player", "bacon_killed")
	RegisterHam(Ham_Spawn, "player", "bacon_spawn_post", 1)
	RegisterHam(Ham_AddPlayerItem, "player", "bacon_addplayeritem")
	RegisterHam(Ham_RemovePlayerItem, "player", "bacon_removeplayeritem")
	
	for(new i = 1; i <= charsmax(g_weapons); i++)
	{
		RegisterHam(Ham_Item_AttachToPlayer, g_weapons[i], "bacon_item_attachtoplayer_post", 1)
		RegisterHam(Ham_Item_Deploy, g_weapons[i], "bacon_item_deploy_post", 1)
	}
}

public plugin_precache()
	precache_model(g_weaponmodel)

public client_putinserver(id)
{
	static infotarget 
	if(!infotarget) infotarget = engfunc(EngFunc_AllocString, "info_target")
	
	g_weaponent[id] = engfunc(EngFunc_CreateNamedEntity, infotarget)
	if(pev_valid(g_weaponent[id]))
	{
		engfunc(EngFunc_SetModel, g_weaponent[id], g_weaponmodel)
		set_pev(g_weaponent[id], pev_classname, g_weaponclass)
		set_pev(g_weaponent[id], pev_movetype, MOVETYPE_FOLLOW)
		set_pev(g_weaponent[id], pev_effects, EF_NODRAW)
		set_pev(g_weaponent[id], pev_aiment, id)
	}
}

public client_disconnected(id)
{
	if(g_weaponent[id] > 0 && pev_valid(g_weaponent[id]))
		engfunc(EngFunc_RemoveEntity, g_weaponent[id])
	
	g_weaponent[id] = 0
}

public bacon_killed(id, idattacker, shouldgib)
	fm_set_entity_visibility(g_weaponent[id], 0)

public bacon_addplayeritem(id, ent)
{
	static weaponid; weaponid = cs_get_weapon_type(ent)
	if(is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))
	{
		fm_set_entity_visibility(g_weaponent[id], 0)
		set_pev(g_weaponent[id], pev_body, get_weapon_model(weaponid))
	}
}

public bacon_removeplayeritem(id, ent)
{
	if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
		fm_set_entity_visibility(g_weaponent[id], 0)
}

public bacon_spawn_post(id) if(is_user_alive(id))
{
	if(!cs_get_user_hasprim(id))
		fm_set_entity_visibility(g_weaponent[id], 0)
}

public bacon_item_attachtoplayer_post(ent, id) if(is_user_alive(id) && !cs_get_user_autoswitch(id))
{
	if(is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
		fm_set_entity_visibility(g_weaponent[id], 1)
}

public bacon_item_deploy_post(ent)
{
	static id; id = pev(ent, pev_owner)
	if(is_user_alive(id) && !ze_is_user_zombie(id))
	{
		if(is_weapon_primary(cs_get_weapon_type(ent)) || cs_get_user_shield(id))
			fm_set_entity_visibility(g_weaponent[id], 0)
		
		else if(cs_get_user_hasprim(id))
			fm_set_entity_visibility(g_weaponent[id], 1)
	}
}

stock get_weapon_model(weapon)
{
	switch(weapon)
	{
		case CSW_SCOUT:   return MODEL_SCOUT
		case CSW_XM1014:  return MODEL_XM1014
		case CSW_AUG:	  return MODEL_AUG
		case CSW_UMP45:   return MODEL_UMP45
		case CSW_SG550:   return MODEL_SG550
		case CSW_GALIL:   return MODEL_GALIL
		case CSW_FAMAS:   return MODEL_FAMAS
		case CSW_AWP:     return MODEL_AWP
		case CSW_MP5NAVY: return MODEL_MP5NAVY
		case CSW_M249:    return MODEL_M249
		case CSW_M3:      return MODEL_M3
		case CSW_M4A1:    return MODEL_M4A1
		case CSW_G3SG1:   return MODEL_G3SG1
		case CSW_SG552:   return MODEL_SG552
		case CSW_AK47:    return MODEL_AK47
		case CSW_P90:     return MODEL_P90
	}
	return 0
}

stock fm_set_entity_visibility(index, visible = 1) 
	set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

Re: Radio Commands

Posted: 12 Aug 2017, 14:15
by Spir0x
Congrats! thank so much [mention]Jack GamePlay[/mention] :p +like

Re: Radio Commands

Posted: 12 Aug 2017, 16:55
by Spir0x
code of backweapons compile but when human infected the weapon still on zombies.
and for the radio u disabled Radio Commands C and Radio Commands C.
with this code human can use Radio commands A with all sounds and the B & C it's like originnaly sounds
and with zombies can't use Radio commands and can use original radio hope you understand me.