TextDrawSetString
#1

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
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);
I show the player the textdraw under onplayerspawn



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;
}
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnect(playerid) || IsPlayerConnect(killerid)) // you use to don't crash's severs
    {
        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);
            TextDrawShowForAll(RoundTxtDrw
        }
    }
    return 1;
}
Reply
#3

format(string, sizeof(string), " Allies: %d/%d Try that.
Reply
#4

It doesn't work either of those ways. maybe it has something to do with how I define my variables?

pawn Код:
new ALLIESKILLS;
new ALLIESDEATHS;
new AXISKILLS;
new AXISDEATHS;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)