SA-MP Forums Archive
Random 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random TextDraw (/showthread.php?tid=66823)



Random TextDraw - stieben - 24.02.2009

Hello,

I have this code right here:

Код:
#include <a_samp>

#define FILTERSCRIPT

#if defined FILTERSCRIPT

forward TextDrawMessageTimer();

new RandomMessages[][] =
{
"Textdraw0","Textdraw1"
};

new Text:Textdraw0;
new Text:Textdraw1;

public OnFilterScriptInit()
{
  SetTimer("TextDrawMessageTimer",120000,1);

  Textdraw0 = TextDrawCreate(187.000000,418.000000,"BlaBlaUUUUH");
  //here I got everything that belonges to Textdraw0
	
  Textdraw1 = TextDrawCreate(187.000000,418.000000,"BlaBlaShittyBla");
  //here I got everything that belonges to Textdraw1


public TextDrawMessageTimer()
{
	TextDrawShowForAll(RandomMessages[random(sizeof(RandomMessages))]); <------- Line 226
}
I get this error:
Код:
(226) : error 035: argument type mismatch (argument 1)code]

Please somebody help me :o



Re: Random TextDraw - yom - 24.02.2009

Look the parameters of TextDrawShowForAll. It require a Text variable, not a string.


Re: Random TextDraw - stieben - 24.02.2009

what do you mean?


Re: Random TextDraw - yom - 24.02.2009

pawn Код:
native TextDrawShowForAll(Text:text);



Re: Random TextDraw - stieben - 24.02.2009

But I want the textdraw to change at random. If I do TextDrawShowForAll(Text:text), the texts doesn't appear random.


Re: Random TextDraw - [RP]Rav - 24.02.2009

You need TextDrawSetString()


Re: Random TextDraw - stieben - 24.02.2009

thanks, I now have this:
Код:
public TextDrawMessageTimer()
{
 	TextDrawSetString(Text:Textdraw0, RandomMessages[random(sizeof(RandomMessages))]);
}
But I think it should only change Textdraw0 now. How to let it remove the current textdraw and replace it with a new?


Re: Random TextDraw - Finn - 24.02.2009

When you use TextDrawSetString, it will change the textdraw on players' screen automatically. You don't need to remove the old one and then show the new one, the function does it for you.

Also: Text:Textdraw0, remove the red part it's useless.


Re: Random TextDraw - stieben - 24.02.2009

Ok, but if I remove Textdraw0 from the code I get 1 error. (same as above)


Re: Random TextDraw - [RP]Rav - 24.02.2009

read his post again