AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Change score between teams (https://forums.alliedmods.net/showthread.php?t=327980)

mrspeak 10-19-2020 16:34

Change score between teams
 
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.

JocAnis 10-19-2020 17:45

Re: Change score between teams
 
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

mrspeak 10-19-2020 20:51

Re: Change score between teams
 
Quote:

Originally Posted by JocAnis (Post 2721938)
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?:

https://i.imgur.com/s4WlvtO.jpg

JocAnis 10-21-2020 10:58

Re: Change score between teams
 
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

mrspeak 10-22-2020 19:04

Re: Change score between teams
 
Well, it works kind of ? but the only problem is it changes imediatly back.

JocAnis 10-22-2020 19:16

Re: Change score between teams
 
okay, i added task of 0.2 sec, can you test it now?

mrspeak 10-22-2020 20:54

Re: Change score between teams
 
Quote:

Originally Posted by JocAnis (Post 2722227)
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 :)


All times are GMT -4. The time now is 20:04.

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