Raised This Month: $ Target: $400
 0% 

Radio


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 07-25-2013 , 20:28   Radio
Reply With Quote #1

I was trying to make custom radio, but there's some bug, when I open the menu, it opened. When it was opened, I tried to open it twice and the radio played. What's wrong?
Also I tried it in LAN connection, other players can't open the menu, only the admin.

PHP Code:
#include <amxmodx>

new g_RadioTimer[33]

stock const male_radio_message_sound[8][] =
{
    
"spk radio/nice_shot.wav",
    
"spk radio/oh_yea.wav",
    
"spk radio/ct_coverme.wav",
    
"spk radio/takepoint.wav",
    
"spk radio/position.wav",
    
"spk radio/regroup.wav",
    
"spk radio/followme.wav",
    
"spk radio/fireassis.wav"
}
stock const female_radio_message_sound[8][] =
{
    
"spk radio/female/nice_shot.wav",
    
"spk radio/female/oh_yea.wav",
    
"spk radio/female/ct_coverme.wav",
    
"spk radio/female/takepoint.wav",
    
"spk radio/female/position.wav",
    
"spk radio/female/regroup.wav",
    
"spk radio/female/followme.wav",
    
"spk radio/female/fireassis.wav"
}
stock const male_radio_request_sound[8][] =
{
    
"spk radio/req_a.wav",
    
"spk radio/req_b.wav",
    
"spk radio/com_go.wav",
    
"spk radio/fallback.wav",
    
"spk radio/sticktog.wav",
    
"spk radio/com_getinpos.wav",
    
"spk radio/stormfront.wav",
    
"spk radio/com_reportin.wav"
}
stock const female_radio_request_sound[8][] =
{
    
"spk radio/female/req_a.wav",
    
"spk radio/female/req_b.wav",
    
"spk radio/female/com_go.wav",
    
"spk radio/female/fallback.wav",
    
"spk radio/female/sticktog.wav",
    
"spk radio/female/com_getinpos.wav",
    
"spk radio/female/stormfront.wav",
    
"spk radio/female/com_reportin.wav"
}
stock const radio_message[8][] =
{
    
"Nice shot!",
    
"Oh! yea",
    
"Cover me",
    
"You take point",
    
"Hold this position",
    
"Regroup team",
    
"Follow me",
    
"Taking fire. Need assistance!"
}
stock const radio_request[8][] =
{
    
"A",
    
"B",
    
"Go Go Go",
    
"Team fall back",
    
"Stick together",
    
"Get in position",
    
"Storm the front",
    
"Report in team"
}

public 
plugin_init()
{
    
register_plugin("Radio","1.1","DavidJr")
    
register_concmd("radio_team""team_message")
    
register_concmd("radio_request""team_request")
    return 
PLUGIN_CONTINUE
}
public 
plugin_precache()
{
    
precache_sound("sound/radio/req_a")
    
precache_sound("sound/radio/req_b")
    
precache_sound("sound/radio/female/req_a")
    
precache_sound("sound/radio/female/req_b")
    
precache_sound("sound/radio/nice_shot")
    
precache_sound("sound/radio/oh_yea")
    
precache_sound("sound/radio/female/nice_shot")
    
precache_sound("sound/radio/female/oh_yea")
}
public 
team_message(id)
{
    new 
menu menu_create("Team message""team_message_cmd")
    
menu_additem(menu"Nice shot!""0"// actually this 0 is set by default, you don't need to write it
    
menu_additem(menu"Oh! yea""1")
    
menu_additem(menu"Cover me""2")  
    
menu_additem(menu"You take point""3")
    
menu_additem(menu"Hold this position""4")    // Add more Options if you wish
    
menu_additem(menu"Regroup team""5")
    
menu_additem(menu"Follow me""6")
    
menu_additem(menu"Taking fire. Need assistance!""7")
    
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}
public 
team_message_cmd(idmenuitem)
{
    if(
menu == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
menu str_to_num(data)
    
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
    
new players[32], totalteam_name[10]
    
get_user_team(idteam_name9)
    
get_players(playerstotal ,"ce"team_name)
    new 
name[32]
    
get_user_name(idname31)
    for(new 
0total; ++i)
    {
        if (
get_cvar_num("female_sound") == 1)
        {
            
client_cmd(players[i], female_radio_message_sound[menu])
        }
        else
        {
            
client_cmd(players[i], male_radio_message_sound[menu])
        }
        
client_print(players[i],print_chat,"%s (Radio): %s"nameradio_message[menu])
        
g_RadioTimer[id] = 1
        set_task
(2.0,"radio_timer",id)
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
team_request(id)
{
    new 
menu menu_create("Team message""team_request_cmd")
    
menu_additem(menu"A""0"// actually this 0 is set by default, you don't need to write it
    
menu_additem(menu"B""1")
    
menu_additem(menu"Go Go Go""2")  
    
menu_additem(menu"Team fall back""3")
    
menu_additem(menu"Stick together""4")    // Add more Options if you wish
    
menu_additem(menu"Get in position""5")
    
menu_additem(menu"Storm the front""6")
    
menu_additem(menu"Report in team""7")
    
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}
public 
team_request_cmd(idmenuitem)
{
    if(
menu == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
data[6], iName[64], accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)
    
menu str_to_num(data)
    
    if(!
is_user_alive(id)) return PLUGIN_HANDLED
    
new players[32], totalteam_name[10]
    
get_user_team(idteam_name9)
    
get_players(playerstotal ,"ce"team_name)
    new 
name[32]
    
get_user_name(idname31)
    for(new 
0total; ++i)
    {
        if (
get_cvar_num("female_sound") == 1)
        {
            
client_cmd(players[i], female_radio_request_sound[menu])
        }
        else
        {
            
client_cmd(players[i], male_radio_request_sound[menu])
        }
        
client_print(players[i],print_chat,"%s (Radio): %s"nameradio_request[menu])
        
g_RadioTimer[id] = 1
        set_task
(2.0,"radio_timer",id)
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}
public 
radio_timer(id)
{
    
g_RadioTimer[id] = 0
    
return PLUGIN_HANDLED
}

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

Randomize is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:24.


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