24.03.2013, 18:20
So I've created a textdraw under ongamodeinit, and set a timer to refresh it every 5 seconds. For some reason, when a player gets a kill(score) for his team, it updates both the TE and CE team to 1, instead of just the team that got the score. Here's my current code.
And under OnPlayerDeath.
Thank you for your help.
EDIT: And its only updating when the enemy team gets a score.
pawn Код:
forward TextDrawRefresh(playerid);
public TextDrawRefresh(playerid)
{
foreach(Player, i)
{
//CT
new string[128];
format(string,sizeof(string), "CT Score: %d",tscore[gTeam[i]]);
TextDrawSetString(TeamScoreCT, string);
TextDrawShowForPlayer(playerid, TeamScoreCT);
//TE
new tstring[128];
format(tstring,sizeof(tstring), "TE Score: %d",tscore[gTeam[i]]);
TextDrawSetString(TeamScoreTE, tstring);
TextDrawShowForPlayer(playerid, TeamScoreTE);
}
}
pawn Код:
tscore[gTeam[killerid]]++;
new astring[128];
format(astring,sizeof(astring), "You have killed %s, and earned one score for your team. (Total Score: %d)",GetName(playerid),tscore[gTeam[killerid]]);
SendClientMessage(killerid,COLOR_CYAN, astring);
if(tscore[gTeam[killerid]] == 10)
{
winner = gTeam[killerid];
new pstring[128];
format(pstring,sizeof(pstring), "%s%s has won the round for %ss. Their team has earned 20k cash, and 20 score.",TeamColor(killerid), GetName(killerid), TeamName(killerid));
SendClientMessageToAll(COLOR_RED, pstring);
ChangeMode();
}
EDIT: And its only updating when the enemy team gets a score.