How to make this? -
MayaEU - 16.07.2016
This should add a label above the player that says if the player is paused..
but the label will not appear
i have this on top of the gamemode
pawn Код:
new Text3D:minpause[MAX_PLAYERS];
i have this onplayerconnect
pawn Код:
minpause[playerid] = Create3DTextLabel(" ", 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(minpause[playerid],playerid, 0.0, 0.0, 0.3);
and this at the timer that detects if the player is paused
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds > 60) // check if it's above 1 minute. secspause minpause minspause
{
format(string, 50, ""COL_AFK"Paused for (%d) minute\n|\nV\n", SecondsToMinutes(PausedSeconds));
Update3DTextLabelText(minpause[i], 0xFFFFFFFF, string);
}
else if(PausedSeconds > 120) // checks if it's below 2 minutes
{
format(string, 50, ""COL_AFK"Paused for (%d) minutes\n|\nV\n", SecondsToMinutes(PausedSeconds));
Update3DTextLabelText(minpause[i], 0xFFFFFFFF, string);
}
else if(PausedSeconds < 60 && PausedSeconds > 0) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_AFK"Paused for (%d) seconds\n|\nV\n", PausedSeconds);
Update3DTextLabelText(minpause[i], 0xFFFFFFFF, string);
}
}
and this detects if the player is no longer paused
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PauseTime[i] == 0)
{
Delete3DTextLabel(minpause[i]);
}
}
Re: How to make this? -
UltraScripter - 16.07.2016
https://sampwiki.blast.hk/wiki/Create3DTextLabel
Re: How to make this? -
MayaEU - 17.07.2016
I tried but it didnt work Can anyone help me?
Re: How to make this? -
d1git - 17.07.2016
Okay cool, now we know you tried it, but what did you try exactly? We need more information to work of off, show us your attempt of getting it to work.
Re: How to make this? -
ColdGamePlay - 17.07.2016
new Text3d:minspause; //In top
new Text3d
![confused](images/smilies/confused.gif)
ecspause
Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds > 60) // check if it's above 1 minute.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) minutes\n|\nV\n", SecondsToMinutes(PausedSeconds));
minspause = Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(minspause,i, 0.0, 0.0, 0.3);
}
else if(PausedSeconds < 60 && PausedSeconds > 0) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) seconds\n|\nV\n", PausedSeconds);
secspause= Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(secspause,i, 0.0, 0.0, 0.3);
}
}
Re: How to make this? -
Sew_Sumi - 17.07.2016
Quote:
Originally Posted by ColdGamePlay
//In top
|
You'll be needing an array first off, but still though, we need more info from him, rather than simply giving him code, to simply come back with the "It's not working" scenario.
Re: How to make this? -
Lynn - 17.07.2016
You can't see 3DTextLabels attached to yourself.
So you will need anther player to test it with, in-order to know if it's working properly or not.
Otherwise it'll always appear to not be working.
Re: How to make this? -
MayaEU - 17.07.2016
I put this, but its giving me errors
pawn Код:
error 035: argument type mismatch (argument 1)
error 017: undefined symbol "secspause"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
pawn Код:
new Text3D:minspause[MAX_PLAYERS];
new Text3Dsecspause[MAX_PLAYERS];
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds > 60) // check if it's above 1 minute.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) minutes\n|\nV\n", SecondsToMinutes(PausedSeconds));
minspause[i] = Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(minspause,i, 0.0, 0.0, 0.3);
}
else if(PausedSeconds < 60 && PausedSeconds > 0) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) seconds\n|\nV\n", PausedSeconds);
secspause[i] = Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(secspause,i, 0.0, 0.0, 0.3);
}
}
Re: How to make this? -
FuNkYTheGreat - 17.07.2016
replace this:
PHP код:
new Text3D:minspause[MAX_PLAYERS];
new Text3Dsecspause[MAX_PLAYERS];
with
PHP код:
new Text3D:minspause[MAX_PLAYERS];
new Text3D:secspause[MAX_PLAYERS];
Re: How to make this? -
MayaEU - 17.07.2016
So would this work?
if they tab it will attach the label, and update it every second?
and delete the label again when the player gets back?
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds > 60) // check if it's above 1 minute.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) minutes\n|\nV\n", SecondsToMinutes(PausedSeconds));
minspause[i] = Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(minspause[i],i, 0.0, 0.0, 0.3);
}
else if(PausedSeconds < 60 && PausedSeconds > 0) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) seconds\n|\nV\n", PausedSeconds);
secspause[i] = Create3DTextLabel(string, 0xFFFFFFFF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(secspause[i],i, 0.0, 0.0, 0.3);
}
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PauseTime[i] > 0)
{
new PausedSeconds = gettime()-PauseTime[i], string[50];
if(PausedSeconds > 60) // check if it's above 1 minute.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) minutes\n|\nV\n", SecondsToMinutes(PausedSeconds));
Update3DTextLabelText(minspause[i], 0xFFFFFFFF, string);
}
else if(PausedSeconds < 60 && PausedSeconds > 0) // checks if it's below 1 minute but above 0 seconds.
{
format(string, 50, ""COL_YELLOW"Paused for (%d) minutes\n|\nV\n", PausedSeconds);
Update3DTextLabelText(secspause[i], 0xFFFFFFFF, string);
}
}
}
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PauseTime[i] == 0)
{
Delete3DTextLabel(minspause[i]);
Delete3DTextLabel(secspause[i]);
}
}