08.07.2009, 04:23
In my gamemode, I've scripted a DM arena, which works with two teams (red and blue)
Id like to make their scores visible via textdraws that update on a player dying. This is the code I have below, it is under my onplayerdeath. The GM compiles without error, but when I die in game,the game crashes. Does anyone see what is wrong, and could you help me fix it?
Id like to make their scores visible via textdraws that update on a player dying. This is the code I have below, it is under my onplayerdeath. The GM compiles without error, but when I die in game,the game crashes. Does anyone see what is wrong, and could you help me fix it?
pawn Код:
if(gTeam[killerid] == TEAM_BLUEDM && gTeam[playerid] == TEAM_BLUEDM){
bluescore -= 1;
format(string, sizeof(string), "Blue Team: %d", bluescore);
TextDrawSetString(bluescoretxt, string);
TextDrawAlignment(bluescoretxt, 1);
TextDrawFont(bluescoretxt, 0);
TextDrawLetterSize(bluescoretxt, 0.1, 0.1);
TextDrawColor(bluescoretxt, 0x0000C1FF);
return 1;
}
if(gTeam[killerid] == TEAM_BLUEDM && gTeam[playerid] == TEAM_REDDM){
bluescore += 1;
format(string, sizeof(string), "Blue Team: %d", bluescore);
TextDrawSetString(bluescoretxt, string);
TextDrawAlignment(bluescoretxt, 1);
TextDrawFont(bluescoretxt, 0);
TextDrawLetterSize(bluescoretxt, 0.1, 0.1);
TextDrawColor(bluescoretxt, 0x0000C1FF);
return 1;
}
if(gTeam[killerid] == TEAM_REDDM && gTeam[playerid] == TEAM_REDDM){
redscore -= 1;
format(string, sizeof(string), "Red Team: %d", redscore);
TextDrawSetString(redscoretxt, string);
TextDrawAlignment(redscoretxt, 1);
TextDrawFont(redscoretxt, 0);
TextDrawLetterSize(redscoretxt, 0.1, 0.1);
TextDrawColor(redscoretxt, 0xAD0000FF);
return 1;
}
if(gTeam[killerid] == TEAM_REDDM && gTeam[playerid] == TEAM_BLUEDM){
redscore += 1;
format(string, sizeof(string), "Red Team: %d", redscore);
TextDrawSetString(redscoretxt, string);
TextDrawAlignment(redscoretxt, 1);
TextDrawFont(redscoretxt, 0);
TextDrawLetterSize(redscoretxt, 0.1, 0.1);
TextDrawColor(redscoretxt, 0xAD0000FF);
return 1;
}