Alt-tabbing System.
#1

How to Create a system
When a im Alt-tabbing its do a Afk Tag Like this: [AFK]
and when i come back its remove this afk tag
(( Sorry For bad English )).
Reply
#2

- Help Please, (( +Rep, For Helpers )).
Reply
#3

Use SetPlayerName to set your name tag as [AFK].

Basically OnPlayerUpdate stops recieving when you're ALT + TAB:ed.
Reply
#4

this will apear above their head.
Код:
format(string, sizeof(string), "[AFK] %s [AFK]", Playerid);
                    new Text3D:label = Create3DTextLabel(string, COLOR_RED, 30.0, 40.0, 50.0, 40.0, 0, 0);
                    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
Reply
#5

Where i need put it?
Onplayerconnect?
Reply
#6

OnPlayerUpdate, as told by SKAzini. Read all posts if you want your stuff to work.
Reply
#7

Try using something like this

PHP код:
new afk[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    
    
SetTimer("AFKTimer"10001);
    return 
1;
}
forward AFKTimer();
public 
AFKTimer()
{
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
            
afk[i]++;
            if (
afk[i] % 30 == 0)
            {
                new 
msg[60];
                
format(msg59"player %d is afk for %d seconds now!"iafk[i]);
                
SendClientMessageToAll(0xFFFFFF00msg);
            }
        }
    }
}
public 
OnPlayerUpdate(playerid)
{
    
afk[playerid] = 0;
    return 
1;

Reply
#8

Код:
public OnPlayerUpdate(playerid)
{
    format(string, sizeof(string), "[AFK] %s [AFK]", Playerid);
    new Text3D:label = Create3DTextLabel(string, 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
	return 1;
}
Код:
G:\NpTDM[0.3e]\gamemodes\NpTDM.pwn(545) : error 017: undefined symbol "string"
G:\NpTDM[0.3e]\gamemodes\NpTDM.pwn(545) : error 017: undefined symbol "string"
G:\NpTDM[0.3e]\gamemodes\NpTDM.pwn(545) : error 029: invalid expression, assumed zero
G:\NpTDM[0.3e]\gamemodes\NpTDM.pwn(545) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
How to fix it?
Reply
#9

Код:
//Where you create all your variables
new stringAFK[17];

public OnPlayerUpdate(playerid)
{
    format(stringAFK, sizeof(stringAFK), "[AFK] %d [AFK]", playerid);
    new Text3D:label = Create3DTextLabel(stringAFK, 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
    return 1;
}
Try this.
Reply
#10

Quote:
Originally Posted by Rimeau
Посмотреть сообщение
Код:
//Where you create all your variables
new stringAFK[16];

public OnPlayerUpdate(playerid)
{
    format(stringAFK, sizeof(stringAFK), "[AFK] %d [AFK]", playerid);
    new Text3D:label = Create3DTextLabel(stringAFK, 0xFF0000FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
    Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
    return 1;
}
Try this.
Why would you want a global variable for something that is only happening locally?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)