AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Change team score in scoreboard? (https://forums.alliedmods.net/showthread.php?t=306923)

GoldNux 04-19-2018 02:56

[HELP] Change team score in scoreboard?
 
I would like to change the team scores with a plugin.
TeamScore event is all I can find, I have searched..

Anyone know?
Thanks.

raizo11 04-19-2018 03:15

Re: [HELP] Change team score in scoreboard?
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
new gmsgScoreInfo
 

public chscore(id,level,cid)
{
        if (!cmd_access(id,level,cid,2))
        {
      return PLUGIN_HANDLED
        }
        new victim[32],deathsI[32],fragsI[32]
        read_argv(1,victim,31)

        read_argv(2,fragsI,31)
        new frags = str_to_num(fragsI)
         
        read_argv(3,deathsI,31)
        new deaths = str_to_num(deathsI)
       
        if (victim[0]=='@')
        {
                new team[32], inum
                get_players(team,inum,"e",victim[1])
                if (inum==0)
                {
                        console_print(id,"[AMX] No clients found on such team.")
                        return PLUGIN_HANDLED
                }
                for (new i=0;i<inum;++i)
                {
                    new teams = get_user_team(team[i]) 
                    set_user_frags(team[i],frags)
                    cs_set_user_deaths(team[i],deaths)
                    message_begin(MSG_ALL,gmsgScoreInfo)
                    write_byte( team[i] ) 
                    write_short(frags)
                    write_short(deaths)
                    write_short(0)
                    write_short(teams)
                    message_end()
                }
        }
        else
        {
                new user = cmd_target(id,victim,0)
                new authid[32]
                get_user_authid(user,authid,31) 
                if (!user)
                {
                        console_print(id,"[AMX] No such client found.")
                        return PLUGIN_HANDLED
                }
                new teams = get_user_team(user)
                set_user_frags(user,frags)
                cs_set_user_deaths(user,deaths)
                message_begin(MSG_ALL,gmsgScoreInfo)
                  write_byte(user)
                  write_short(frags)
                  write_short(deaths)
                  write_short(0)
                  write_short(teams)
                  message_end()
          }
        return PLUGIN_HANDLED
}


public plugin_init()
{
        register_plugin("Change Score","2.0.5","Freecode")
        register_clcmd("amx_chscore","chscore",ADMIN_CVAR," - amx_chscore <nick/@CT/@TERRORIST> <frags #> <deaths #>")
        gmsgScoreInfo = get_user_msgid("ScoreInfo")
}


GoldNux 04-19-2018 03:31

Re: [HELP] Change team score in scoreboard?
 
Quote:

Originally Posted by raizo11 (Post 2588425)
Code:

CODE...

Thank you for responding!
But does this plugin change TEAM score or just player score?

raizo11 04-19-2018 03:59

Re: [HELP] Change team score in scoreboard?
 
team and player

GoldNux 04-19-2018 04:43

Re: [HELP] Change team score in scoreboard?
 
Quote:

Originally Posted by raizo11 (Post 2588431)
team and player

Thank you I am very grateful!

I would like to implement this in a plugin that keeps track of the team scores.
It stores the team scores in two variables that change whenever a win sound is played.

Instead of printing the scores to chat:
console_cmd(0, "say CT: %d | T: %d <~>", g_ScoreCT, g_ScoreT)

I like it to change the scores on the scoreboard.
What part of the code would I use for this?

I'm still trying to learn to use messages.
And I am not familiar with editing team scores.

Care to maybe explain a little?

Thank you very much.


edit: I found this thread. https://forums.alliedmods.net/showthread.php?t=233339


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

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