Quote:
Originally Posted by Bugsy
1. Your register_event() is calling 'eventNewRound' and it should be 'FreezeTimeStart'.
2. You should call 1 set_task() in FreezeTimeStart and loop through all players within updatePlayerEconomy().
3. Include flags in get_players() to exclude bots and hltv and remove this check in updatePlayerEconomy().
4. Only call cs_get_user_team() once and set the value in a variable. Then do:
if ( CS_TEAM_T <= iTeam <= CS_TEAM_CT )
|
Thank you for being so helpful and patient!
It is working, but I can't test it with bots for some reason.
Even without the "ch" flags.
The idea is, that the chat can display a maximum of 5 chat messages.
So while playing 5 vs 5, as long as it prints every message in the same order it will look pretty good.
Very strange that my previously very similar code makes bots print it, but not this.. Oh well!
Here is the code for anyone else doing something similar in the future.
Thanks again @Bugsy I really appreciate it!
Code:
#include <amxmodx>
#include <cstrike>
new g_pFreezeTime;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV" , "FreezeTimeStart" , "a" , "1=0" , "2=0");
g_pFreezeTime = get_cvar_pointer("mp_freezetime");
}
public FreezeTimeStart()
{
set_task(1.0,"updatePlayerEconomy", .flags="a", .repeat=get_pcvar_num(g_pFreezeTime));
}
public updatePlayerEconomy()
{
new players[32];
new playercount, i;
get_players(players, playercount, "ch");
for (i=0; i<playercount; i++)
if (cs_get_user_team(players[i]) != CS_TEAM_SPECTATOR)
{
client_cmd(players[i],"say_team $ %d",cs_get_user_money(players[i]))
}
}
__________________