Hi.
I want to make a plugin, which will play sound for winning and loosing team (2 different sound's).
So i made that code:
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Test"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("SendAudio", "event_roundend_t", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "event_roundend_ct", "a", "2&%!MRAD_ctwin")
}
public plugin_precache()
{
precache_sound("misc/win.mp3")
precache_sound("misc/lose.mp3")
}
public event_roundend_t(id)
{
if (get_user_team(id) == 2)
{
//client_cmd(id, "mp3 play sound/misc/lose")
client_print(id,print_center, "You are CT")
}
if ((get_user_team(id) == 1))
{
//client_cmd(id, "mp3 play sound/misc/win")
client_print(id,print_center, "You are TT")
}
}
public event_roundend_ct(id)
{
if (get_user_team(id) == 1)
{
//client_cmd(id, "mp3 play sound/misc/lose")
client_print(id,print_center, "You are CT")
}
if ((get_user_team(id) == 2))
{
//client_cmd(id, "mp3 play sound/misc/win")
client_print(id,print_center, "You are TT")
}
}
When i'm not chcecking team's, sound/print is working, but when i'm doing it, nothing happens (and not error's). I also tried with cs_get_user_team, but same effect.
I tried to save checking team's on spawn, and then add it to MRAD, but nothing:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Test"
new CsTeams:xTeam[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("SendAudio", "event_roundend_t", "a", "2&%!MRAD_terwin")
//register_event("SendAudio", "event_roundend_ct", "a", "2&%!MRAD_ctwin")
RegisterHam(Ham_Spawn, "player", "Spawn", 1);
}
public plugin_precache()
{
precache_sound("misc/win.mp3")
precache_sound("misc/lose.mp3")
}
public event_roundend_t(id)
{
if(is_user_connected(id) && xTeam[id] == CS_TEAM_T)
{
//client_cmd(id, "mp3 play sound/misc/win")
client_print(id,print_center, "Jestes TT")
}
}
public Spawn(id)
{
xTeam[id] = cs_get_user_team(id)
if(is_user_connected(id) && xTeam[id] == CS_TEAM_T)
client_print(id, print_chat, "You're terro");
}
Any ideas? Maybe you know another way to play 2 different sound's when any team lose or win?