Raised This Month: $ Target: $400
 0% 

[Help] Teamscore event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
connoisseur
Senior Member
Join Date: Jan 2012
Old 07-28-2013 , 13:21   [Help] Teamscore event
Reply With Quote #1

Code:
public Event_TeamScore() {     new szTeam[2];     read_argv(1, szTeam, charsmax(szTeam));     if (szTeam[0] == 'T')     {         g_iTsScore = read_data(2);      }     else     {         g_iCTsScore = read_data(2);     }     if(g_iCTsScore == 8)     {         match_over(1);     }     else if (g_iTsScore == 8)     {         match_over(2);     }     return PLUGIN_HANDLED }   match_over(num) {     new szName[32]     get_user_name(g_qid[num],szName,31)     //g_qid[1] = ct player id, g_qid[2] = t player id     client_print(0,print_chat,"%s has won !!", szName)     client_print(0,print_chat,"%s has won !!", szName) }
When I was testing this, I was in T and even when CT player won 8 rounds, the printing showed "<my nick> has won !!"

Last edited by connoisseur; 07-29-2013 at 13:14.
connoisseur is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-28-2013 , 13:47   Re: [Help] Teamscore event
Reply With Quote #2

Where are you assigning g_id a value?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 07-29-2013 , 12:53   Re: [Help] Teamscore event
Reply With Quote #3

Code:
//plugin_init register_clcmd("say /ready", "cmdReady") //function public cmdReady(id) {     if(g_qflag[id])     {         client_print(id,print_chat,"Already in the queue.")         return PLUGIN_CONTINUE     }     g_qflag[id] = 1     g_qnum++     g_qid[g_i] = id     //storing indexes in queue numbers     g_i++     client_print(id,print_chat,"Placed in the queue at %d position", g_qnum)     return PLUGIN_HANDLED }
connoisseur is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-29-2013 , 13:10   Re: [Help] Teamscore event
Reply With Quote #4

g_id is not found in that block of code
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 07-29-2013 , 13:16   Re: [Help] Teamscore event
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
g_id is not found in that block of code
Sorry that was a typo in the first post.. edited.
It was g_qid only.
connoisseur is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-29-2013 , 14:34   Re: [Help] Teamscore event
Reply With Quote #6

Then you set your system up incorrectly as as you are passing 1 or 2 as the winner, so only 2nd or 3rd person ready will ever be shown as the winner, even if they didn't win.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-29-2013 , 14:52   Re: [Help] Teamscore event
Reply With Quote #7

PHP Code:
match_over(num)
{
    new 
szName[32]
    
get_user_name(g_qid[num],szName,31)     //g_qid[1] = ct player id, g_qid[2] = t player id
    
client_print(0,print_chat,"%s has won !!"szName)
    
client_print(0,print_chat,"%s has won !!"szName)

What should this show? Team name? Names of people who are in winners team?
MPD is offline
Send a message via Skype™ to MPD
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-30-2013 , 01:25   Re: [Help] Teamscore event
Reply With Quote #8

TeamScore is always sent twice, the first time CT Score is passed, the second time Ts.
So you have to wait for Ts score in order to perform your checks.
Also, don't return PLUGIN_HANDLED in an event callback, it has no effect.
just use return with no value, or use return PLUGIN_CONTINUE, in your code, no return was needed, i've added one because of the first thing i told you.

PHP Code:
public Event_TeamScore()
{
    new 
szTeam[2];
    
read_argv(1szTeamcharsmax(szTeam));
    if (
szTeam[0] == 'T')
    {
        
g_iTsScore read_data(2);  
    }
    else
    {
        
g_iCTsScore read_data(2);
        return; 
// CT score comes before T score
    
}

    if(
g_iCTsScore == 8)
    {
        
match_over(1);
    }
    else if (
g_iTsScore == 8)
    {
        
match_over(2);
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 15:51.


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