Random TextDraw
#1

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

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

what do you mean?
Reply
#4

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

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

You need TextDrawSetString()
Reply
#7

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?
Reply
#8

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

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

read his post again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)