Random Textdraw Postion - 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: Random Textdraw Postion (
/showthread.php?tid=569851)
Random Textdraw Postion -
bboytimix - 03.04.2015
hey i got a problem wth that thing
the problem is all ok the textdraw have a random postion but only once till the gamemode restart i mean the postion not changing its stck on one postion till i exit or restart the gm here is my code
PHP код:
new Text:GainXPTD[MAX_PLAYERS];
new Float:Randomxpshowpos[11][2] =
{
{363.0000,221.0000},
{352.0000,251.0000},
{354.0000,341.0000},
{353.0000,231.0000},
{355.0000,252.1200},
{356.0000,229.1000},
{243.0000,228.8000},
{233.0000,226.6000},
{123.0000,321.4000},
{113.0000,221.2000},
{103.0000,221.0000}
};
under public OnGameModeInit
for(new i; i < MAX_PLAYERS;i++)
{
GainXPTD[i] = TextDrawCreate(Randomxpshowpos[random(sizeof(Randomxpshowpos))][0],Randomxpshowpos[random(sizeof(Randomxpshowpos))][1], "_");
TextDrawFont(GainXPTD[i], 2);
TextDrawLetterSize(GainXPTD[i], 0.27, 2.67);
TextDrawColor(GainXPTD[i], 0x00ff5933);
TextDrawSetOutline(GainXPTD[i], 1);
TextDrawSetProportional(GainXPTD[i], 1);
Re: Random Textdraw Postion -
JeaSon - 03.04.2015
make a timer for that
pawn Код:
public OnGameModeInit()
{
SetTimer("RandomTextDraws", 2000, true); // in every 2mins timer will be repeated
return 1;
}
forward RandomTextDraws();
public RandomTextDraws()
{
for(new i; i < MAX_PLAYERS;i++)
{
GainXPTD[i] = TextDrawCreate(Randomxpshowpos[random(sizeof(Randomxpshowpos))][0],Randomxpshowpos[random(sizeof(Randomxpshowpos))][1], "_");
TextDrawFont(GainXPTD[i], 2);
TextDrawLetterSize(GainXPTD[i], 0.27, 2.67);
TextDrawColor(GainXPTD[i], 0x00ff5933);
TextDrawSetOutline(GainXPTD[i], 1);
TextDrawSetProportional(GainXPTD[i], 1);
}
return 1;
}