SA-MP Forums Archive
Textdraw Updating Failure. - 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 Updating Failure. (/showthread.php?tid=558029)



Textdraw Updating Failure. - Lynn - 15.01.2015

When a player joins, it shows the Join message for the first connection, however after that
No message is displayed. Only if Connections = 0.

Top of Script:
pawn Код:
new Text:JoinMsg[4];
new Connections;
GameModeInit
pawn Код:
Connections = 0;
OnPlayerConnect
pawn Код:
new joinstr[70];
    format(joinstr, sizeof joinstr, "~w~(~r~%i~w~)~r~%s ~w~has ~g~joined ~w~the server.", playerid, pName(playerid));
    Display_JoinMsg(joinstr);
OnPlayerSpawn
pawn Код:
TextDrawShowForPlayer(playerid, JoinMsg[0]);
    TextDrawShowForPlayer(playerid, JoinMsg[1]);
    TextDrawShowForPlayer(playerid, JoinMsg[2]);
    TextDrawShowForPlayer(playerid, JoinMsg[3]);
Textdraws
pawn Код:
JoinMsg[0] = TextDrawCreate(456.500000, 350.933349, "");
    TextDrawLetterSize(JoinMsg[0], 0.165388, 1.556442);
    TextDrawAlignment(JoinMsg[0], 1);
    TextDrawColor(JoinMsg[0], -1);
    TextDrawSetShadow(JoinMsg[0], 0);
    TextDrawSetOutline(JoinMsg[0], 1);
    TextDrawBackgroundColor(JoinMsg[0], 51);
    TextDrawFont(JoinMsg[0], 1);
    TextDrawSetProportional(JoinMsg[0], 1);

    JoinMsg[1] = TextDrawCreate(456.500000, 336.622222, "");
    TextDrawLetterSize(JoinMsg[1], 0.165388, 1.556442);
    TextDrawAlignment(JoinMsg[1], 1);
    TextDrawColor(JoinMsg[1], -1);
    TextDrawSetShadow(JoinMsg[1], 0);
    TextDrawSetOutline(JoinMsg[1], 1);
    TextDrawBackgroundColor(JoinMsg[1], 51);
    TextDrawFont(JoinMsg[1], 1);
    TextDrawSetProportional(JoinMsg[1], 1);

    JoinMsg[2] = TextDrawCreate(456.500000, 322.311126, "");
    TextDrawLetterSize(JoinMsg[2], 0.165388, 1.556442);
    TextDrawAlignment(JoinMsg[2], 1);
    TextDrawColor(JoinMsg[2], -1);
    TextDrawSetShadow(JoinMsg[2], 0);
    TextDrawSetOutline(JoinMsg[2], 1);
    TextDrawBackgroundColor(JoinMsg[2], 51);
    TextDrawFont(JoinMsg[2], 1);
    TextDrawSetProportional(JoinMsg[2], 1);

    JoinMsg[3] = TextDrawCreate(456.000000, 308.000000, "");
    TextDrawLetterSize(JoinMsg[3], 0.165388, 1.556442);
    TextDrawAlignment(JoinMsg[3], 1);
    TextDrawColor(JoinMsg[3], -1);
    TextDrawSetShadow(JoinMsg[3], 0);
    TextDrawSetOutline(JoinMsg[3], 1);
    TextDrawBackgroundColor(JoinMsg[3], 51);
    TextDrawFont(JoinMsg[3], 1);
    TextDrawSetProportional(JoinMsg[3], 1);
Bottom of Script:
pawn Код:
stock Display_JoinMsg(string[])
{
    switch(Connections) {
        case 0: TextDrawSetString(JoinMsg[3], string);
        case 1: TextDrawSetString(JoinMsg[2], string);
        case 2: TextDrawSetString(JoinMsg[1], string);
        case 3: TextDrawSetString(JoinMsg[0], string);
    }
    return 1;
}



Re: Textdraw Updating Failure. - xVIP3Rx - 15.01.2015

I think you're setting them before making/showing them, Make sure you're making them first, then showing them, then setting their new string,

Also try to show them anywhere to make sure they're already shown and in the correct position, their coordination might be incorrect too.


Re: Textdraw Updating Failure. - Lynn - 15.01.2015

Still only the first Player Joinning textdraw is updated.


Re: Textdraw Updating Failure. - vassilis - 17.01.2015

First of all i think you should TextDrawShowForAll because the textdraw will be shown only to id 0??


Re: Textdraw Updating Failure. - Lynn - 17.01.2015

I fixed it, I'm not sure what was wrong.
The way I fixed it was re-writting all the code and re-creating the textdraws.
So somewhere I had a massive error, Also it wasn't even showing for ID 0.