TextDraw
#1

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.
Reply
#2

"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.
Reply
#3

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)