Pkayer 3D Text Label :(
#1

Hey guys, I'm trying to create a 3D Text Label that appears above a players head if they are afk.

So basically, if a player types /afk it will make a label appear saying "AFK"
then when they type /back it will delete it.
Can someone please help me with this??
Reply
#2

Something like this ?

PHP код:
    if(strcmp(cmdtext,"/afk",true)==0)
    {
        if(
IsPlayerConnected(playerid))
        {
            {
                if(
afk[playerid] == 0)
                {
                    if(
AfkTimerTimer[playerid]) return SendClientMessage(playerid,COLOR_GREY,"   You must wait 3 seconds before using that again !");
                    
GetPlayerPos(playerid, PlayerPosition[playerid][PosX], PlayerPosition[playerid][PosY], PlayerPosition[playerid][PosZ]);
                    
AfkTimerTimer[playerid] = 1;
                    
SendClientMessage(playerid, COLOR_GREY,"You must remain in your current position for 10 seconds.");
                    
SetTimerEx("AfkTimer",10*1000,0,"i",playerid);
                    return 
1;
                }
                else
                {
                    
SetPlayerColor(playerid, TCOLOR_WHITE);
                    
format(string, sizeof(string), "[AdmWarning]: %s Is no longer AFK",PlayerName(playerid));
                    
ABroadCast(COLOR_YELLOW,string,1);
                    
SetPlayerHealth(playerid, 30);
                    
AfkTimerTimer[playerid] = 0;
                    
Delete3DTextLabel(AFKLabel[playerid]);
                    
SendClientMessage(playerid, COLOR_GREY, "You are no longer in AFK mode, and you are now able to move again!");
                    
TogglePlayerControllable(playerid, 1);
                    
afk[playerid] = 0;
                    return 
1;
                }
            }
        }
        return 
1;
    } 
And

PHP код:
public AfkTimer(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    if(
AfkTimerTimer[playerid])
    {
        new 
Float:X, Float:Y, Float:Z;
        
GetPlayerPos(playerid, X, Y, Z);
        if(
PlayerPosition[playerid][PosX] == X && PlayerPosition[playerid][PosY] == Y && PlayerPosition[playerid][PosZ] == Z)
        {
            
SetPlayerColor(playerid, TCOLOR_LIGHTGREEN);
            
SetPlayerHealth(playerid, 999);
            
AFKLabel[playerid] = Create3DTextLabel("Player is AFK",0x008B00FF,0,0,0,50,-1,1);
            
Attach3DTextLabelToPlayer(AFKLabel[playerid], playerid, 0,0,0);
            
SendClientMessage(playerid, COLOR_GREY, "You are now AFK, and you are not able to move.(type /afk to exit the AFK mode)");
              
TogglePlayerControllable(playerid, 0);
            
afk[playerid] = 1;
            
AfkTimerTimer[playerid] = 0;
            
SendClientMessage(playerid, COLOR_YELLOW, "You are now AFK.");
        }
        else
        {
            
AfkTimerTimer[playerid] = 0;
            
SendClientMessage(playerid, COLOR_GREY, "   You have moved from your position !");
        }
    }
    return 
1;
} 
And at the Top :

PHP код:
forward AfkTimer(playerid); 
Reply
#3

Holy fk, lol no not that advanced.

Just need to know what the code is to show 'AFK' above their head when they are /afk
Reply
#4

PHP код:
Create3DTextLabel("Player is AFK",0x008B00FF,0,0,0,50,-1,1); 
Reply
#5

pawn Код:
AFKLabel[playerid] = Create3DTextLabel("Player is AFK",0x008B00FF,0,0,0,50,-1,1);
            Attach3DTextLabelToPlayer(AFKLabel[playerid], playerid, 0,0,0);
Reply
#6

Yeah Forgot Attach3DTextLabelToPlayer - My bad
Reply
#7

What do I put if I want to remove it?
Reply
#8

PHP код:
Delete3DTextLabel(AFKLabel[playerid]); 
Btw you have to put this Up :

PHP код:
new Text3D:AFKLabel[MAX_PLAYERS]; 
Reply
#9

Quote:
Originally Posted by Breto
Посмотреть сообщение
PHP код:
Delete3DTextLabel(AFKLabel[playerid]); 
Btw you have to put this Up :

PHP код:
new Text3D:AFKLabel[MAX_PLAYERS]; 
PHP код:
C:\Users\Gaming\Desktop\SAMP\gamemodes\WW.pwn(533) : error 017: undefined symbol "playerid" 
Reply
#10

give as a script where you put that! (not just that line)
Reply


Forum Jump:


Users browsing this thread: