30.10.2010, 23:17
I made a script.I have 2 teams . A and B
I made a script to show each Team score as a textdraw!
The problem is that when a team A killed a member from team B the score for team A does not change,but when Team B kills team A the score changes!
here is the code
I made a script to show each Team score as a textdraw!
The problem is that when a team A killed a member from team B the score for team A does not change,but when Team B kills team A the score changes!
here is the code
pawn Код:
//top of script
new Monstersscore;
new Humansscore;
new Text:scores;
pawn Код:
//onplayerdeath
if(killerid == TEAM_MONSTERS)
{
Monstersscore ++;
}
if(killerid == TEAM_HUMANS)
{
Humansscore ++;
}
pawn Код:
forward ScoreUpdate(playerid);
public ScoreUpdate(playerid)
{
new string[100];
TextDrawHideForAll(Text:scores);
format(string,sizeof(string),"~r~Monsters: %d \n~g~Humans: %d",Monstersscore,Humansscore);
scores = TextDrawCreate(350.000000,10.000000,string);
TextDrawTextSize(scores,600.000000,0.500000);
TextDrawSetOutline(scores,1);
TextDrawSetShadow(scores,1);
TextDrawSetString(scores,string);
TextDrawShowForAll(Text:scores);
}
forward ScoreCheck(playerid);
public ScoreCheck(playerid)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (Monstersscore >= 20) {
Monstersscore = 0;
Humansscore = 0;
GameTextForAll("~r~Monsters ~g~have won",6000,5);
SetPlayerHealth(i, 0);
}
if (Humansscore >= 20) {
Monstersscore = 0;
Humansscore = 0;
GameTextForAll("~w~Humans ~g~have won",6000,5);
SetPlayerHealth(i, 0);
}
}
}