SA-MP Forums Archive
Error trying to random a 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: Error trying to random a textdraw (/showthread.php?tid=611650)



Error trying to random a textdraw - barbarbar1 - 09.07.2016

pawn Код:
TextDrawShowForPlayer(playerid, RandomTDs[random(sizeof(RandomTDs))]);
Error:
error 035: argument type mismatch (argument 2)

RandomTDs:
pawn Код:
new RandomTDs[][] =
{
    "Textdraw0",
    "Textdraw1",
    "Textdraw2",
    "Textdraw3",
    "Textdraw4",
    "Textdraw5"
};



Re: Error trying to random a textdraw - GangstaaSunny - 09.07.2016

Hello barbarbar1,
please use the search function before open a new thread.
https://sampforum.blast.hk/showthread.php?tid=327709 - Tutorial by Dripac

https://sampforum.blast.hk/showthread.php?tid=501669 - Filterscript by Remba031

http://forum.sa-mp.com/showpost.php?...73&postcount=7 - Answer by Jeffrey

etc...


Re: Error trying to random a textdraw - barbarbar1 - 09.07.2016

Quote:
Originally Posted by GangstaaSunny
Посмотреть сообщение
Hello barbarbar1,
please use the search function before open a new thread.
https://sampforum.blast.hk/showthread.php?tid=327709 - Tutorial by Dripac

https://sampforum.blast.hk/showthread.php?tid=501669 - Filterscript by Remba031

http://forum.sa-mp.com/showpost.php?...73&postcount=7 - Answer by Jeffrey

etc...
This one is about changing the text in textdraws. I am speaking about changing the textdraws themselves by random.


Re: Error trying to random a textdraw - WrathOfGenesis - 09.07.2016

Better to use a switch function here, rather than an array

pawn Код:
switch ( random ( 5 ) )
{
    case 0: TextDrawShowForPlayer ( playerid , TextDraw1 );
    case 1: TextDrawShowForPlayer ( playerid , TextDraw2 );
    case 2: TextDrawShowForPlayer ( playerid , TextDraw3 );
    case 3: TextDrawShowForPlayer ( playerid , TextDraw4 );
    case 4: TextDrawShowForPlayer ( playerid , TextDraw5 );
}
Don't forget to hide the previous textdraw before you've shown the player the new one


Re: Error trying to random a textdraw - GangstaaSunny - 09.07.2016

Hello barbarbar1,
its the same coding stuff. Just edit the functions.