Raised This Month: $32 Target: $400
 8% 

How to get Team Score?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MihaiGamerXD
Member
Join Date: Aug 2018
Old 08-24-2018 , 09:53   How to get Team Score?
Reply With Quote #1

I'm now in another thread! I wanted to know how to get Team Score? For example:

If I'm CT, and I killed someone, The CT Team have increased a score, and if I'm TR, and I killed someone, The TR Team have increased a score! And when the game is over, I mean when the game shows the highscore, the sound is playing!

And I tried this code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>

new ct_score 0
new t_score 0

new const ct_win[] = "ct/yes!.wav"
new const t_win[] = "t/no!.wav"

public plugin_init() {
    
register_event("DeathMsg","onDeath","a"//This is the Death Event
    
register_event("30","TheEnd","a"//This is the Intermission Event, that means this event is used when the highscore shows
}

public 
onDeath() {
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    if (
iKiller && iVictim && iKiller != iVictim) {
        if (
is_user_alive(iKiller)) {
            if (
cs_get_user_team(iKiller) == CS_TEAM_CT) {
                
ct_score += 0
            
}
            if (
cs_get_user_team(iKiller) == CS_TEAM_T) {
                
t_score += 0
            
}
        }
    }
}

public 
TheEnd(id) {
    if (
ct_score t_score) {
        
client_cmd(id,"spk %s",ct_win)
    }
    if (
ct_score t_score) {
        
client_cmd(id,"spk %s",t_win)
    }

But it not worked!

Can anyone help me?

And I'm sorry for what have I done with the thread. But I promise I'll never get wrong.
MihaiGamerXD is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-24-2018 , 11:03   Re: How to get Team Score?
Reply With Quote #2

How are you expecting to increase the score by 0.

ct_score += 0
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
MihaiGamerXD
Member
Join Date: Aug 2018
Old 08-24-2018 , 12:36   Re: How to get Team Score?
Reply With Quote #3

Ops! Forgot about that! Thank you, but still not working! I just increased the score by 1 now! But this can't be happening!

Last edited by MihaiGamerXD; 08-24-2018 at 12:41.
MihaiGamerXD is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-24-2018 , 12:43   Re: How to get Team Score?
Reply With Quote #4

http://wiki.amxmodx.org/Half-Life_1_...ents#TeamScore

Store each team's score in a global variable.
__________________









Last edited by CrazY.; 08-24-2018 at 12:43.
CrazY. is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 08-24-2018 , 12:51   Re: How to get Team Score?
Reply With Quote #5

So this event is used for increasing score for each team when a Terrorist killed a CT?

Old Edit: Please show me the example code about this event.

New Edit: OMG! IT WORKED! THANK YOU! I tried this code:

PHP Code:
plugin_init() {
    
register_event("TeamScore","event_terrorist_win","a","TERRORIST")
}

public 
event_terrorist_win(id) {
    
client_cmd(id,"stopsound")
    
client_cmd(id,"spk %s",t_win//I didn't do t_win[] because I'm just showing only the event code, but still working thank you

But now it works! Thank you very much my hero!

Now I guess all of my plugins that I had are ready to post my own mod!

Last edited by MihaiGamerXD; 08-24-2018 at 13:12.
MihaiGamerXD is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-24-2018 , 13:06   Re: How to get Team Score?
Reply With Quote #6

Quote:
This message updates the team score on the scoreboard.
Code:
#include <amxmodx> new g_iTeamScoreT, g_iTeamScoreCT; public plugin_init() {     register_message(get_user_msgid("TeamScore"), "messageTeamScore"); } // Not sure if it is called for every player. public messageTeamScore(iMsgId, iMsgDest, pevEntity) {     new szTeamName[2];     get_msg_arg_string(1, szTeamName, charsmax(szTeamName));     new iTeamScore = get_msg_arg_int(2);     switch(szTeamName[0])     {         case 'T':             g_iTeamScoreT = iTeamScore;         case 'C':             g_iTeamScoreCT = iTeamScore;     } }
__________________









Last edited by CrazY.; 08-24-2018 at 13:09.
CrazY. is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 08-24-2018 , 13:13   Re: How to get Team Score?
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
Code:
#include <amxmodx> new g_iTeamScoreT, g_iTeamScoreCT; public plugin_init() {     register_message(get_user_msgid("TeamScore"), "messageTeamScore"); } // Not sure if it is called for every player. public messageTeamScore(iMsgId, iMsgDest, pevEntity) {     new szTeamName[2];     get_msg_arg_string(1, szTeamName, charsmax(szTeamName));     new iTeamScore = get_msg_arg_int(2);     switch(szTeamName[0])     {         case 'T':             g_iTeamScoreT = iTeamScore;         case 'C':             g_iTeamScoreCT = iTeamScore;     } }
No thanks my own code worked! Or maybe I need it!

Last edited by MihaiGamerXD; 08-24-2018 at 13:35. Reason: Because the problem is: When I'm a CT and I killed all the Terrorists, the sound is playing like the t_win variable!
MihaiGamerXD is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 08-24-2018 , 13:51   Re: How to get Team Score?
Reply With Quote #8

So how can I play the sound at the end of the game via your codes? to play different sounds!
MihaiGamerXD is offline
Old 08-26-2018, 05:27
MihaiGamerXD
This message has been deleted by HamletEagle. Reason: Stop bumping, it's not allowed.
MihaiGamerXD
Member
Join Date: Aug 2018
Old 09-25-2018 , 15:29   Re: How to get Team Score?
Reply With Quote #9

Are you kidding me?
I need to make my own plugin TO PLAY FOR FUN, AND YOU'RE FUCKING JOKING AT ME AND I'M NOT BUMPING!!!!!! NO ONE CAN HELP ME???? THAT'S IT!!!!!! I'M GONNA DELETE ALL OF MY PLUGINS, AND THEN I'LL KILL YOUR MOTHER!!!!!!!!
MihaiGamerXD is offline
MihaiGamerXD
Member
Join Date: Aug 2018
Old 09-25-2018 , 15:30   Re: How to get Team Score?
Reply With Quote #10

And ban me!!!!!! What are you waiting for, ban me, i don't need help, i'm done, and i'm talking with the one who deleted my reply!!!!!

Last edited by MihaiGamerXD; 09-25-2018 at 15:31.
MihaiGamerXD 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 22:37.


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