Hello, I was trying to port my plugin earlier and I decided to go in and add radar flashing, well the instructions were here:
So I added it in (look at function radio4_radarflash()) , and my code looks fine to me:
Code:
/***************************************************************************/
/* Unhidden Radio v0.30 */
/* by Downtown1 */
/***************************************************************************/
/* This plugin allows users to bind to 'radio4' and use the radio commands */
/* that the new versions of Counter-Strike seemingly left out. */
/* Come to 67.18.170.100 if you wish to try it out first. */
/*
========================= Version History ===================================
*** 0.30 - ported to AMX X
- person using command will now flash on radar without using +-voicecommand
- spam semi-protection (delay between commands), on-die protection
*** 0.22 - fixed indentations so they are all the same
*** 0.21 - made people using radio4 flash on radar by using +-voicecommand
*** 0.2 - added icons above player's head -- thanks to EJ for letting me look
*** at his code :-)
*** 0.13 - dead players can't use radio anymore
*** 0.12 - changed one of the radio commands
*** 0.11 - now uses one function with parameters where the case statements are
*** 0.1 - first version of plugin: features 'radio4'
- execs speak sound and sends a Name (RADIO) : msg! to the team
*/
#include <amxmodx>
#define TE_RADIOFLASH 112
new szUserName[32]
new iTeammateCount, szUserTeamPlayers[32]
new sprRadioIcon
#define RADIO_DELAY 13 //people can use the radio command once every 13*0.1s and no more to prevent *spamming*
public radio4_showmenu(id) {
if ( !(is_user_alive(id)) )
return PLUGIN_HANDLED
new szRadioMenu[256] //to store the options for the menu
new szUserTeam[32] //to store the team name of the user
get_user_name(id, szUserName, 31) //what is the user's name?
get_user_team(id, szUserTeam, 31) //what is the name of his team?
get_players(szUserTeamPlayers, iTeammateCount, "ace", szUserTeam) //who are the players on his team?
format(szRadioMenu,256,"\yRadio Menu: %s^n\w^n1. Circle around back!^n2. I'm hit!.^n3. Hit and need assistance.^n4. I'll take the point.^n5. Meet at the rendezvous.^n6. Follow my command.^n7. Let's get outta here.^n8. Move out.^n9. Teammate down!^n^n0. Cancel",szUserName)
show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),szRadioMenu)
return PLUGIN_HANDLED
}
radio4_result (szWavFile[], szRadioMessage[], id) {
new iUserCoordinates[3] //write down the user coordinates here
get_user_origin(id, iUserCoordinates)
for (new i = 0; i < iTeammateCount; i++) {
//client_cmd(id, "+voicerecord")
// client_cmd(id, "-voicerecord")
new szFormattedRadioMessage[128], szWavExecute[128]
format (szWavExecute, 127, "speak radio/%s", szWavFile)
format (szFormattedRadioMessage, 127, "%s (RADIO): %s", szUserName, szRadioMessage)
client_cmd(szUserTeamPlayers[i], szWavExecute) //play the radio sound
client_print(szUserTeamPlayers[i], print_chat, szFormattedRadioMessage) //print the radio message to the teammates
radio4_icon(id, szUserTeamPlayers[i]) //flash the exclamation mark above the person's head
if (szUserTeamPlayers[i] != id)
radio4_radarflash(szUserTeamPlayers[i], iUserCoordinates) //make the person appear on radar
// client_cmd(id, "+voicerecord")
// client_cmd(id, "-voicerecord")
}
}
public radio4_execmenu(id, key) {
if ( !(is_user_alive(id)) ) //prevent user from choosing a menu option after he's dead
return PLUGIN_HANDLED
switch(key) {
case 0: {
radio4_result ("circleback.wav", "Circle around back!", id)
}
case 1:
{
radio4_result ("ct_imhit.wav", "I'm hit!", id)
}
case 2:
{
radio4_result ("hitassist.wav", "I'm hit, need assistance!", id)
}
case 3:
{
radio4_result ("ct_point.wav", "I'll take the point!", id)
}
case 4:
{
radio4_result ("meetme.wav", "Meet at the rendezvous point.", id)
}
case 5:
{
radio4_result ("com_followcom.wav", "Okay team, follow my command.", id)
}
case 6:
{
radio4_result ("getout.wav", "Team, let's get out of here!", id)
}
case 7:
{
radio4_result ("moveout.wav", "All right, let's move out!", id)
}
case 8:
{
radio4_result ("matedown.wav", "Teammate down!", id)
}
}
return PLUGIN_HANDLED
}
radio4_icon(id, player)
{
new i[3]
message_begin( MSG_ONE , SVC_TEMPENTITY, i , player)
write_byte(124)
write_byte(id)
write_coord(35)
write_short(sprRadioIcon)
write_short(15)
message_end()
// return PLUGIN_HANDLED
}
radio4_radarflash(player, coords[3])
{
// new i[3]
message_begin( MSG_ONE , SVC_TEMPENTITY, coords , player)
write_byte(TE_RADIOFLASH) //# of the event I guess?
// write_byte(20) //duration of the flash, we can try 2 seconds at first to see if it works
write_coord( coords[0] ) //x coord?
write_coord( coords[1] ) //y coord??
write_coord( coords[2] ) //z coord??
message_end()
// return PLUGIN_HANDLED
}
public plugin_precache()
{
sprRadioIcon = precache_model("sprites/radio.spr")
}
public plugin_init()
{
register_plugin("Radio Unhidden","0.30","Downtown1")
register_menucmd(register_menuid("\yRadio Menu: "), 1023, "radio4_execmenu")
register_clcmd("radio4_devel","radio4_showmenu",-1," - shows a menu of a hidden CS radio commands")
return PLUGIN_CONTINUE
}
But when I run CS and someone chooses a radio command, my CS crashes and I get this error: