GameTextForPlayer issue - 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: GameTextForPlayer issue (
/showthread.php?tid=624789)
GameTextForPlayer issue -
TheDarkBlade - 22.12.2016
I have an issue with GameTextForPlayer .
The text are the numbers from a countdown but insted the textdraw prints 182 instead of the right number .
I added a print function and it prints the right numbers.
PHP код:
forward GameTextForEvent(const string[]);
public GameTextForEvent(const string[])
{
foreach(Player,i)
{
if(IsPlayerConnected(i))
{ if(PartEvent[i] == 1)
{
GameTextForPlayer(i,string,1000,4);
}
}
}
return 1;
}
forward CountDownEvent();
public CountDownEvent()
{
CountDownVar--;
printf("%d",CountDownVar);
new string[128];
if(CountDownVar == 0)
{
KillTimer(CountDownEventTimer);
CountDownVar = 5;
foreach(Player,i)
{
if(PartEvent[i] == 1)
{
TogglePlayerControllable(i,1);
format(string,sizeof(string),"%d mai sunt in event!",EventPlayers);
TextDrawSetString(EventTXD,string);
}
}
}
else
{
SetTimer("CountDownEvent",1000,false);
format(string, sizeof(string), "%d", CountDownEventTimer);
GameTextForEvent(string);
}
return 1;
}
Re: GameTextForPlayer issue -
Nero_3D - 22.12.2016
That is because you are using the wrong variable in format
Re: GameTextForPlayer issue -
Yaa - 22.12.2016
PHP код:
forward GameTextForEvent(const string[]);
public GameTextForEvent(const string[])
{
foreach(Player,i)
{
if(IsPlayerConnected(i))
{ if(PartEvent[i] == 1)
{
GameTextForPlayer(i,string,1000,4);
}
}
}
return 1;
}
forward CountDownEvent();
public CountDownEvent()
{
CountDownVar--;
printf("%d",CountDownVar);
new string[128];
if(CountDownVar == 0)
{
KillTimer(CountDownEventTimer);
CountDownVar = 5;
foreach(Player,i)
{
if(PartEvent[i] == 1)
{
TogglePlayerControllable(i,1);
format(string,sizeof(string),"%d mai sunt in event!",EventPlayers);
TextDrawSetString(EventTXD,string);
}
}
}
else
{
SetTimer("CountDownEvent",1000,false);
format(string, sizeof(string), "%d", CountDownVar);
GameTextForEvent(string);
}
return 1;
}