About 3dTextLabel - 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: About 3dTextLabel (
/showthread.php?tid=612871)
About 3dTextLabel -
MayaEU - 22.07.2016
Hi, i have this system that checks if the player is paused/tabbed.
But sometimes when you just login to the server it will attach a label to you
saying that you have been paused for example: 12674654 minutes. What can that cause?
This on top of gamemode
pawn Код:
new Text3D:minpause[MAX_PLAYERS];
And this on OnPlayerDisConnect
pawn Код:
Delete3DTextLabel(minpause[playerid]);
This on OnPlayerConnect
pawn Код:
minpause[playerid] = Create3DTextLabel(" ", COLOR_BIZ, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(minpause[playerid],playerid, 0.0, 0.0, 0.7);
This is the timer that will attach the label when you are tabbed/paused
pawn Код:
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds < 120 && PausedSeconds > 59) // check if it's above 1 minute. secspause minpause minspause
{
format(string, 50, ""COL_AFK"PAUSED\n%d minute\n|\nV\n \n \n", SecondsToMinutes(PausedSeconds));
Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
}
else if(PausedSeconds > 120) // checks if it's below 2 minutes
{
format(string, 50, ""COL_AFK"PAUSED\n%d minutes\n|\nV\n \n \n", SecondsToMinutes(PausedSeconds));
Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
}
else if(PausedSeconds < 60 && PausedSeconds > 3) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_AFK"PAUSED\n%d seconds\n|\nV\n \n \n", PausedSeconds);
Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
}
}
And this will remove the label when you are no longer paused
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds == 0)
{
format(string, 50, " ");
Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
}
}
Re: About 3dTextLabel -
Freaksken - 22.07.2016
You need to reset PauseTime[playerid] in OnPlayerConnect.