How to make this?
#1

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]);
        }
    }
Reply
#2

https://sampwiki.blast.hk/wiki/Create3DTextLabel
Reply
#3

I tried but it didnt work Can anyone help me?
Reply
#4

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.
Reply
#5

new Text3d:minspause; //In top
new Text3decspause

Код:
    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);
        }
	}
Reply
#6

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.
Reply
#7

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.
Reply
#8

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);
        }
    }
Reply
#9

replace this:
PHP код:
new Text3D:minspause[MAX_PLAYERS];
new 
Text3Dsecspause[MAX_PLAYERS]; 
with
PHP код:
new Text3D:minspause[MAX_PLAYERS];
new 
Text3D:secspause[MAX_PLAYERS]; 
Reply
#10

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]);
        }
    }
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)