29.07.2012, 18:08
Hello,i've created this textdraws to show the score of blue and red team,but it doesn't work!
Here is all:
OnGameModeInit:
OnPlayerConnect:
And this is how the score of each team is counted (1 kill = 1 score for the team)
The timer on OnGameModeInit:
And the public:
OnPlayerDeath:
The problem is,it doesnt update the textdraws when a player from a team make a kill,it stays everytime on 0.
Thanks all for help!
Here is all:
pawn Код:
new Text:BTSTxd;
new Text:RTSTxd;
pawn Код:
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i, BTSTxd);
TextDrawShowForPlayer(i, RTSTxd);
}
}
pawn Код:
BTSTxd = TextDrawCreate(505.000000, 303.000000, "Blue Team:");
TextDrawBackgroundColor(BTSTxd, 255);
TextDrawFont(BTSTxd, 2);
TextDrawLetterSize(BTSTxd, 0.350000, 1.200000);
TextDrawColor(BTSTxd, 1097465770);
TextDrawSetOutline(BTSTxd, 1);
TextDrawSetProportional(BTSTxd, 1);
RTSTxd = TextDrawCreate(505.000000, 324.000000, "Red Team:");
TextDrawBackgroundColor(RTSTxd, 255);
TextDrawFont(RTSTxd, 2);
TextDrawLetterSize(RTSTxd, 0.350000, 1.200000);
TextDrawColor(RTSTxd, -16776961);
TextDrawSetOutline(RTSTxd, 1);
TextDrawSetProportional(RTSTxd, 1);
pawn Код:
TextDrawShowForPlayer(playerid, BTSTxd);
TextDrawShowForPlayer(playerid, RTSTxd);
pawn Код:
forward TeamScore(playerid);
pawn Код:
ScoreTimer = SetTimer("TeamScore",1000,1);
pawn Код:
public TeamScore()
{
new BlueTeamScore[100];
format(BlueTeamScore,sizeof(BlueTeamScore),"Blue Team: %d",TeamBlueScore);
TextDrawSetString(BTSTxd,BlueTeamScore);
new RedTeamScore[100];
format(RedTeamScore,sizeof(RedTeamScore),"Red Team: %d",TeamRedScore);
TextDrawSetString(RTSTxd,RedTeamScore);
return 1;
}
pawn Код:
if(GetPlayerTeam(killerid) == TEAM_BLUE)
{
TeamBlueScore ++;
}
if(GetPlayerTeam(killerid) == TEAM_RED)
{
TeamRedScore ++;
}
Thanks all for help!