19.03.2012, 02:26
Ok so I am trying to set a string to a textdraw however it doesn't work here is the code I have can someone point out what the issue is and why the textdraw stays the same after a player dies or gets murdered by another player
under ongamemodeinit
I show the player the textdraw under onplayerspawn
and here is where I set the string of the textdraw
under ongamemodeinit
pawn Код:
RoundTxtDrw = TextDrawCreate( 0, 435, " Allies: 0/0 Axis 0/0");
TextDrawFont(RoundTxtDrw , 1);
TextDrawLetterSize(RoundTxtDrw, 0.5, 1.5);
TextDrawColor(RoundTxtDrw, COLOR_WHITE);
TextDrawSetOutline(RoundTxtDrw , false);
TextDrawSetProportional(RoundTxtDrw , true);
TextDrawSetShadow(RoundTxtDrw , 1);
TextDrawUseBox(RoundTxtDrw, 1);
TextDrawBoxColor(RoundTxtDrw, 0x000000FF);
and here is where I set the string of the textdraw
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
pKills[killerid] ++;
pDeaths[playerid] ++;
if(roundinprogress == true)
{
new string[128];
SpawnInRound(playerid);
if(gTeam[playerid] == 0)
{
if(killerid == INVALID_PLAYER_ID)
{
AXISDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
ALLIESKILLS ++;
}
}
if(gTeam[playerid] == 1)
{
if(killerid == INVALID_PLAYER_ID)
{
ALLIESDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
AXISKILLS ++;
}
}
format(string, sizeof(string), " Allies: %i/%i Axis: %i/%i", ALLIESKILLS, ALLIESDEATHS, AXISKILLS, AXISDEATHS);
TextDrawSetString(RoundTxtDrw, string);
for(new t; t<MAX_PLAYERS; t++)
{
TextDrawShowForPlayer(t, RoundTxtDrw);
}
}
return 1;
}