Raised This Month: $12 Target: $400
 3% 

Solved Change score between teams


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mrspeak
Junior Member
Join Date: Apr 2020
Old 10-19-2020 , 16:34   Change score between teams
Reply With Quote #1

Hello everyone,
Short story, i'm making a mix/competitve (idk how to call it) plugin for a friend.
He wants like in round 15 to automatically change teams and score from scoretab between them.
I've searched and found a "solution" i tought from oprheu_memory but it didn't work... Like no error nothing happend just didn't work.
So how do i change the score between the teams or how to i set them :-?.
Now i will apreciate if you could help me with that.

Last edited by mrspeak; 10-23-2020 at 03:42.
mrspeak is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-19-2020 , 17:45   Re: Change score between teams
Reply With Quote #2

test this maybe? i think its possible without orpheu
(use 'amx_chscore' to test if it will swap score)

https://forums.alliedmods.net/showpo...25&postcount=2
__________________
KZ Public Autocup - PrimeKZ

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

Last edited by JocAnis; 10-19-2020 at 17:46.
JocAnis is offline
mrspeak
Junior Member
Join Date: Apr 2020
Old 10-19-2020 , 20:51   Re: Change score between teams
Reply With Quote #3

Quote:
Originally Posted by JocAnis View Post
test this maybe? i think its possible without orpheu
(use 'amx_chscore' to test if it will swap score)

https://forums.alliedmods.net/showpo...25&postcount=2
How would that help me to change these?:

mrspeak is offline
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
mrspeak
Junior Member
Join Date: Apr 2020
Old 10-22-2020 , 19:04   Re: Change score between teams
Reply With Quote #5

Well, it works kind of ? but the only problem is it changes imediatly back.
mrspeak is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 10-22-2020 , 19:16   Re: Change score between teams
Reply With Quote #6

okay, i added task of 0.2 sec, can you test it now?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
mrspeak
Junior Member
Join Date: Apr 2020
Old 10-22-2020 , 20:54   Re: Change score between teams
Reply With Quote #7

Quote:
Originally Posted by JocAnis View Post
okay, i added task of 0.2 sec, can you test it now?
i tought of that too, i wanted to test that later. That's anyway exactly what i need from now on i can manage it.
Thank you again

Last edited by mrspeak; 10-22-2020 at 20:56.
mrspeak 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 13:12.


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