PHP Code:
#include <amxmodx>
#define PLUGIN "Set team scores"
#define AUTHOR "Alliedmods SEARCH function"
#define VERSION "1.0"
new gTeamScore;
new Score[2];
public plugin_init()
{
gTeamScore = get_user_msgid("TeamScore") // Assign gTeamScore to the msgid that gets sent to the client.
set_msg_block(gTeamScore, BLOCK_SET) // We block it, so the server doesn't send it when we don't want to.
register_clcmd( "setscore", "cmd_Setscore", ADMIN_KICK, "<T> <CT> (sets score)"); // Register clcmd.
}
public cmd_Setscore() // If you want to, you can also pass an id here and print the info only to the command user.
{
new arg[32], arg1[32];
read_argv( 1, arg, 31 );
read_argv( 2, arg1, 31 );
new l_scoreT = str_to_num(arg);
new l_scoreCT = str_to_num(arg1);
Score[0] = l_scoreT;
Score[1] = l_scoreCT;
SetScore();
client_print(0, print_chat, "TEAM T = %i | TEAM CT = %i", l_scoreT, l_scoreCT); // feel free to comment this out, or/and modify it as you want.
}
public SetScore(){ // Credits to somebody else, found on alliedmodders by SEARCHING (incredible technology, right?)
message_begin(MSG_ALL,gTeamScore)
write_string("TERRORIST")
write_short(Score[0])
message_end()
message_begin(MSG_ALL,gTeamScore)
write_string("CT")
write_short(Score[1])
message_end()
}
Usage: setscore x x
first number being for T's and second for CT's.
->> Credits for the msg stuff:
https://forums.alliedmods.net/showthread.php?t=233339
__________________