Raised This Month: $ Target: $400
 0% 

Solved Change score between teams


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-21-2020 , 10:58   Re: Change score between teams
Reply With Quote #4

alright, my mistake for that link, here is the code:
Code:
#include <amxmodx>
#include <amxmisc>

new g_msgTeamScore
new g_iScore[ 2 ] //0 = tr, 1 = ct

public plugin_init()
{
    register_plugin( "swap scores", "1.0", "swapper" )

    g_msgTeamScore = get_user_msgid("TeamScore")

    register_event( "SendAudio", "trWin", "a", "2&%!MRAD_terwin" ) //count tr wins
    register_event( "SendAudio", "ctWin", "a", "2&%!MRAD_ctwin" ) //count ct wins

    register_event("HLTV", "event_new_round", "a", "1=0", "2=0") //count rounds overall
}
public trWin() g_iScore[ 0 ]++
public ctWin() g_iScore[ 1 ]++

public event_new_round()
{
    if( g_iScore[ 0 ] + g_iScore[ 1 ] == 15 )
        set_task( 0.2, "swap_scoreboard" )
}
public swap_scoreboard()
{
    message_begin( MSG_ALL, g_msgTeamScore )
    write_string( "TERRORIST" )
    write_short( g_iScore[ 1 ] ) //change TR score to CT from before
    message_end()

    message_begin( MSG_ALL, g_msgTeamScore )
    write_string( "CT" )
    write_short( g_iScore[ 0 ] ) //change ct score to previously-TR
    message_end()
}
its without orpehu/reapi, thanks to E1_531G (https://forums.alliedmods.net/showthread.php?t=315161)

my code is more like a example , im not sure if it will work very well, so you must change some parts a little...especially with 'if( g_iScore[ 0 ] + g_iScore[ 1 ] == 15 )', test with different numbers
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 10-22-2020 at 19:16.
JocAnis is offline
 



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 13:45.


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