SA-MP Forums Archive
TextDraw - 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 (/showthread.php?tid=662845)



TextDraw - oghabanjb - 13.01.2019

Hi all. This is my code:
pawn Код:
public OnPlayerConnect(playerid)
{
    OghabServer = TextDrawCreate(580.0,42.0,"Oghab~n~Server");
    TextDrawAlignment(OghabServer, 2);
    TextDrawFont(OghabServer, 3);
    TextDrawSetOutline(OghabServer, 1);
    TextDrawLetterSize(OghabServer, 0.6 ,1.2);
   
    TextDrawShowForPlayer(playerid,OghabServer);
    SetTimer("ChangeTDColor",1000,true);
    return 1;
}
public ChangeTDColor()
{
    TextDrawColor(OghabServer,Colors[random(sizeof(Colors))]);
    return 1;
}
SetTimer does not work and colors do not change.


Re: TextDraw - L0K3D - 13.01.2019

"If the TextDraw is already shown, it must be re-shown (TextDrawShowForAll/TextDrawShowForPlayer) for the changes of this function to take effect" - from SA:MP Wiki.


Re: TextDraw - Jeffry - 13.01.2019

You have to create the Textdraw in OnGameModeInit, otherwise it will be created over and over again, each time a user connects to your server.
Also start the Timer in OnGameModeInit.

Within the public of the Timer use TextDrawColor and TextDrawShowForAll.


Re: TextDraw - oghabanjb - 13.01.2019

Quote:
Originally Posted by L0K3D
Посмотреть сообщение
"If the TextDraw is already shown, it must be re-shown (TextDrawShowForAll/TextDrawShowForPlayer) for the changes of this function to take effect" - from SA:MP Wiki.
Oh thanks it's worked.