Why
// "%!MRAD_GO",
(is commented)? + why there is a single whole function just for this command ? TrieSetCell(g_tRadioSounds, "%!MRAD_GO", 1)
- like I don't know why I commented and if it's because that function or.. idk..
PS: I tried on my country forum (here).. no chance at all for a reply (even if there are so many that know scripting (made more plugins for allied..), don't care or lazy )
Code: Select all
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define m_flNextRadio 191
#define m_iRadiosLeft 192
enum _:SendAudio_Datas
{
SenderID = 1,
AudioCode,
Pitch
}
new Float:g_flRoundStart_GameTime
new Trie:g_tRadioSounds
new g_pCvarRadioDelay, g_pCvarRadioMax
public plugin_init()
{
register_plugin("Radio Flood Management", "0.0.2", "ConnorMcLeod")
g_pCvarRadioDelay = register_cvar("amx_radio_delay", "3.0") // (CS) Default: 1.5
g_pCvarRadioMax = register_cvar("amx_radio_max", "60") // (CS) Default: 60
RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1)
register_logevent("LogEvent_Round_Start", 2, "1=Round_Start")
register_event("SendAudio", "Event_SendAudio_Radio", "be", "2&%!MRAD_")
new const szRadioSounds[][] = {
"%!MRAD_COVERME",
"%!MRAD_TAKEPOINT",
"%!MRAD_POSITION",
"%!MRAD_REGROUP",
"%!MRAD_FOLLOWME",
"%!MRAD_HITASSIST",
// "%!MRAD_GO",
"%!MRAD_FALLBACK",
"%!MRAD_STICKTOG",
"%!MRAD_GETINPOS",
"%!MRAD_STORMFRONT",
"%!MRAD_REPORTIN",
"%!MRAD_ROGER", "%!MRAD_AFFIRM",
"%!MRAD_ENEMYSPOT",
"%!MRAD_BACKUP",
"%!MRAD_CLEAR",
"%!MRAD_INPOS",
"%!MRAD_REPRTINGIN",
"%!MRAD_BLOW",
"%!MRAD_NEGATIVE",
"%!MRAD_ENEMYDOWN"
}
g_tRadioSounds = TrieCreate()
for(new i; i<sizeof(szRadioSounds); i++)
{
TrieSetCell(g_tRadioSounds, szRadioSounds[i], 0)
}
TrieSetCell(g_tRadioSounds, "%!MRAD_GO", 1)
}
public LogEvent_Round_Start()
{
g_flRoundStart_GameTime = get_gametime()
}
/*
Name: SendAudio
Structure:
byte SenderID
string AudioCode
short Pitch
*/
public Event_SendAudio_Radio(id)
{
new iSender = read_data(SenderID)
if( iSender != id )
{
return
}
new szAudioCode[18], bGoGoGo
read_data(AudioCode, szAudioCode, charsmax(szAudioCode))
if( TrieGetCell(g_tRadioSounds, szAudioCode, bGoGoGo) )
{
if( bGoGoGo && get_gametime() == g_flRoundStart_GameTime )
{
return
}
set_pdata_float(id, m_flNextRadio, get_gametime() + get_pcvar_float(g_pCvarRadioDelay))
}
}
public Player_Spawn_Post( id )
{
if( is_user_alive(id) )
{
set_pdata_int(id, m_iRadiosLeft, get_pcvar_num(g_pCvarRadioMax))
}
}
public plugin_end()
{
TrieDestroy(g_tRadioSounds)
}