TextDraw not showing correct score.
#1

So I'm trying to add a text draw for my two teams. It will show their current score. But when a person from the team kills a enemy, it doesn't update the score.

It's under OnGameModeInIt.
pawn Код:
// Team Score CT TD
   
    new string[128];
    format(string,sizeof(string), "CT Score: %d",tscore[gTeam[playerid]]);
    TeamScoreCT = TextDrawCreate(28 ,286 , string);
    TextDrawFont(TeamScoreCT, 1);
    TextDrawLetterSize(TeamScoreCT, 0.5, 3.5);
    TextDrawColor(TeamScoreCT, -1);
    TextDrawSetOutline(TeamScoreCT, 0);
    TextDrawSetProportional(TeamScoreCT , 1);
    TextDrawSetShadow(TeamScoreCT, 1);
    // Team Score TE TD
    new tstring[128];
    format(tstring,sizeof(tstring), "TE Score: %d",tscore[gTeam[playerid]]);
    TeamScoreTE = TextDrawCreate(28 ,286 , tstring);
    TextDrawFont(TeamScoreTE , 1);
    TextDrawLetterSize(TeamScoreTE , 0.5, 3.5);
    TextDrawColor(TeamScoreTE , -1);
    TextDrawSetOutline(TeamScoreTE , false);
    TextDrawSetProportional(TeamScoreTE , true);
    TextDrawSetShadow(TeamScoreTE , 1);
Thanks.
Reply
#2

u still didn't show the textdraw
pawn Код:
//under onplayerspawn
TextDrawShowForPlayer(playerid, TeamScoreCT);
TextDrawShowForPlayer(playerid, TeamScoreTE);
Reply
#3

Indeed I did. Under onplayerspawn.
pawn Код:
if (gTeam[playerid] == TEAM_CT)
        {
            TextDrawShowForPlayer(playerid, TeamCT);
            TextDrawShowForPlayer(playerid, TeamScoreCT);
        }
        else if (gTeam[playerid] == TEAM_TE)
        {
            TextDrawShowForPlayer(playerid, TeamTE);
            TextDrawShowForPlayer(playerid, TeamScoreTE);
Reply
#4

It doesn't update unless you tell it to do so. (TextDrawSetString)
Reply
#5

And how would I go by telling it to update?
Reply
#6

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
And how would I go by telling it to update?
onplayerdeath

when someone dies

team++

i suggest you download a script already done with this and just copy it to yours
Reply
#7

Alright have that. But how do I update the textdraw?
Reply
#8

you can update it using timer + TextDrawSetString
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)