SA-MP Forums Archive
TextDraw not showing correct score. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: TextDraw not showing correct score. (/showthread.php?tid=424822)



TextDraw not showing correct score. - rangerxxll - 23.03.2013

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.


Re: TextDraw not showing correct score. - Glad2BeHere - 23.03.2013

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



Re: TextDraw not showing correct score. - rangerxxll - 23.03.2013

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);



Re: TextDraw not showing correct score. - Vince - 23.03.2013

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


Re: TextDraw not showing correct score. - rangerxxll - 23.03.2013

And how would I go by telling it to update?


Re: TextDraw not showing correct score. - andrewgrob - 23.03.2013

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


Re: TextDraw not showing correct score. - rangerxxll - 23.03.2013

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


Re: TextDraw not showing correct score. - Patrick - 23.03.2013

you can update it using timer + TextDrawSetString