Raised This Month: $ Target: $400
 0% 

Check team's on round end - problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krysteksulek
Member
Join Date: Aug 2013
Location: Poland
Old 05-27-2014 , 18:46   Check team's on round end - problem
Reply With Quote #1

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?

Last edited by krysteksulek; 05-27-2014 at 18:47.
krysteksulek is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-28-2014 , 00:24   Re: Check team's on round end - problem
Reply With Quote #2

Code:
new whichsound = random_num(1,2) switch(whichsound) { case 1: case 2: }

for 2 random sounds

im not sure about those events tho, what I'd do is count the players on the round end myself and determine the winning team
Code:
new countt = 0, countct = 0         new iPlayers[32];         new iNum;         new player;         get_players( iPlayers, iNum )         for( new i = 0; i < iNum; i++ )         {             player = iPlayers[i]             if(cs_get_user_team(player)==CS_TEAM_T)             countt=countt+1             else if(cs_get_user_team(player)==CS_TEAM_CT)             countct=countct+1         } if(!countct) { //cts win } else if(!coutt) { //ts win }

Last edited by aron9forever; 05-28-2014 at 00:24.
aron9forever is offline
Old 05-28-2014, 07:34
krysteksulek
This message has been deleted by krysteksulek.
Reply



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 19:53.


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