SA-MP Forums Archive
Textdraw update problem - 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 update problem (/showthread.php?tid=619213)



Textdraw update problem - Shaheen - 15.10.2016

Hi samp,
I had made a textdraw that works with string.

My Textdraw with string should be updated after every 24mins in game. but unfortunately its not updating and it is showing the updated string only after relogging. i need to get a function that isused to update tesxtdraw without relogging,

here the codes of txd
PHP код:
formatstringsizeof( string ), "AOTD :%s"AOTD_WinnerName );
    
Textdraw20 CreatePlayerTextDraw(playerid,546.00000015.000000string );
    
PlayerTextDrawBackgroundColor(playerid,Textdraw20255);
    
PlayerTextDrawFont(playerid,Textdraw201);
    
PlayerTextDrawLetterSize(playerid,Textdraw200.1900001.300000);
    
PlayerTextDrawColor(playerid,Textdraw20, -1);
    
PlayerTextDrawSetOutline(playerid,Textdraw200);
    
PlayerTextDrawSetProportional(playerid,Textdraw201);
    
PlayerTextDrawSetShadow(playerid,Textdraw201);
    
PlayerTextDrawSetSelectable(playerid,Textdraw200);
    
PlayerTextDrawShow(playeridTextdraw20);
    
////////////////potd txd
    
new msg[256];
    
formatmsgsizeofmsg ), "POTD :%s"POTD_WinnerName );
    
Textdraw21 CreatePlayerTextDraw(playerid,547.00000027.000000msg );
    
PlayerTextDrawBackgroundColor(playerid,Textdraw21255);
    
PlayerTextDrawFont(playerid,Textdraw211);
    
PlayerTextDrawLetterSize(playerid,Textdraw210.1800001.300000);
    
PlayerTextDrawColor(playerid,Textdraw21, -1);
    
PlayerTextDrawSetOutline(playerid,Textdraw210);
    
PlayerTextDrawSetProportional(playerid,Textdraw211);
    
PlayerTextDrawSetShadow(playerid,Textdraw211);
    
PlayerTextDrawSetSelectable(playerid,Textdraw210);
    
PlayerTextDrawShow(playeridTextdraw21); 



Re: Textdraw update problem - TaiRinsuru - 15.10.2016

Show us your code in 24mins updating textdraw.


Re: Textdraw update problem - Mencent - 15.10.2016

Hello.

You must start a timer to update the textdraw.
When it's a global name (so the winner is for all people the same) then you can use global textdraws.

When you don't know how you should do this with a timer then feel free to ask again.


Re: Textdraw update problem - Shaheen - 15.10.2016

plz help me about it. i am unfamiliar with timer update


Re: Textdraw update problem - Logic_ - 15.10.2016

Use a timer, search on SA-MP wiki for that.


Re: Textdraw update problem - Shaheen - 15.10.2016

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Use a timer, search on SA-MP wiki for that.
after using a timer how to update it ??


Re: Textdraw update problem - Mencent - 15.10.2016

I wrote your playertextdraws to global textdraws because this is better for the performance (when you use the timer) and the winnernames are for all people the same so a global textdraw is enough.

PHP код:
//the textdraws (OnGameModeInit):
formatstringsizeof( string ), "AOTD :%s"AOTD_WinnerName );
Textdraw20 TextDrawCreate(546.00000015.000000string );
TextDrawBackgroundColor(Textdraw20255);
TextDrawFont(Textdraw201);
TextDrawLetterSize(Textdraw200.1900001.300000);
TextDrawColor(Textdraw20, -1);
TextDrawSetOutline(Textdraw200);
TextDrawSetProportional(Textdraw201);
TextDrawSetShadow(Textdraw201);
TextDrawSetSelectable(Textdraw200);
TextDrawShow(Textdraw20);
////////////////potd txd
new msg[50];
formatmsgsizeofmsg ), "POTD :%s"POTD_WinnerName );
Textdraw21 TextDrawCreate(547.00000027.000000msg );
TextDrawBackgroundColor(Textdraw21255);
TextDrawFont(Textdraw211);
TextDrawLetterSize(Textdraw210.1800001.300000);
TextDrawColor(Textdraw21, -1);
TextDrawSetOutline(Textdraw210);
TextDrawSetProportional(Textdraw211);
TextDrawSetShadow(Textdraw211);
TextDrawSetSelectable(Textdraw210);
TextDrawShow(Textdraw21); 
PHP код:
//OnGameModeInit
SetTimer("OnTextDrawUpdate",1000*60*24,1); //24 minuten
//callback for the timer
forward OnTextDrawUpdate();
public 
OnTextDrawUpdate()
{
    new 
string[40];
     
format(string,sizeof string,"AOTD: %s",AOTD_WinnerName);
    
TextDrawSetString(Textdraw20,string);
    
format(string,sizeof string,"POTD: %s",POTD_WinnerName);
    
TextDrawSetString(Textdraw21,string);
    return 
1;

There where you define the Textdraws (PlayerText:Textdraw20 and PlayerText:Textdraw21) you must change PlayerText: to Text:


Re: Textdraw update problem - Shaheen - 15.10.2016

giving this error :
warning 213: tag mismatch


Re: Textdraw update problem - Mencent - 15.10.2016

Where do you get this error?
Do you have
PHP код:
new Text:Textdraw20
and
PHP код:
new Text:Textdraw21
?


Re: Textdraw update problem - Yaa - 15.10.2016

Quote:

new Text:Textdraw21

to

Quote:

new Text:Textdraw[22]

And chnage all numbers after "Textdraw" to [x]

example :

Textdraw22

to Textdraw[22]

And the error fixed