Quote:
Originally Posted by Bugsy
Since cs_get_user_team() returns a CsTeams type, you need to define the iPTeam variable as CsTeams. You were also missing a closing bracket. Natsheh, you should avoid calling cs_get_user_team() multiple times for the same player.
I didn't look at your code beyond this, not sure if it does what you expect. Give it a try.
CODE...
|
Natshehs contribution opened up the posibility to use client_print_color, before I had an issue using it.
Even when setting the "CT" and "TERRORIST" flag, it still printed to both teams.
I wrote something that change the color of the money, to indicate what you can afford.
It is working great, but I don't think my code is very optimized.
Maybe someone can take a look?
I will later combine this with the get equipment
code you wrote.
Anyways, here is the color chat code.
I know I should store get_* in variables, but when I do I get warnings and errors.
I'm obviously not doing it right.
Code:
#include <cromchat>
public updatePlayerEconomy()
{
new players[32], playercount, player, player2, szName[32];
get_players(players, playercount, "h");
for(new i, j, CsTeams:iPTeam, iPMoney; i < playercount; i++)
{
player = players[i];
if (CS_TEAM_T <= (iPTeam=cs_get_user_team(player)) <= CS_TEAM_CT)
{
iPMoney = cs_get_user_money(player);
get_user_name(player, szName, charsmax(szName));
for(j = 0; j < playercount; j++)
{
player2 = players[j];
if (iPTeam != cs_get_user_team(player2)) continue;
{
if (cs_get_user_team(player2) == CS_TEAM_T && !is_user_hltv(player2) && cs_get_user_team(player2) != CS_TEAM_SPECTATOR)
{
if (iPMoney < 3000)
CC_SendMessage(player2, "%s:&x07 $ %d", szName, iPMoney)
else if (iPMoney > 3000 && iPMoney < 3500)
CC_SendMessage(player2, "%s:&x01 $ %d", szName, iPMoney)
else if (iPMoney > 3500 && iPMoney < 10000)
CC_SendMessage(player2, "%s:&x04 $ %d", szName, iPMoney)
else if (iPMoney > 10000)
CC_SendMessage(player2, "%s:&x06 $ %d", szName, iPMoney)
}
else if (cs_get_user_team(player2) == CS_TEAM_CT && !is_user_hltv(player2) && cs_get_user_team(player2) != CS_TEAM_SPECTATOR)
{
if (iPMoney < 3250)
CC_SendMessage(player2, "%s:&x07 $ %d", szName, iPMoney)
else if (iPMoney > 3250 && iPMoney < 4100)
CC_SendMessage(player2, "%s:&x01 $ %d", szName, iPMoney)
else if (iPMoney > 4100 && iPMoney < 10000)
CC_SendMessage(player2, "%s:&x04 $ %d", szName, iPMoney)
else if (iPMoney > 10000)
CC_SendMessage(player2, "%s:&x06 $ %d", szName, iPMoney)
}
}
}
}
}
}
__________________