SA-MP Forums Archive
Pkayer 3D Text Label :( - 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: Pkayer 3D Text Label :( (/showthread.php?tid=299981)



Pkayer 3D Text Label :( - Thresholdold - 28.11.2011

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??


Re: Pkayer 3D Text Label :( - -CaRRoT - 28.11.2011

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(playeridPlayerPosition[playerid][PosX], PlayerPosition[playerid][PosY], PlayerPosition[playerid][PosZ]);
                    
AfkTimerTimer[playerid] = 1;
                    
SendClientMessage(playeridCOLOR_GREY,"You must remain in your current position for 10 seconds.");
                    
SetTimerEx("AfkTimer",10*1000,0,"i",playerid);
                    return 
1;
                }
                else
                {
                    
SetPlayerColor(playeridTCOLOR_WHITE);
                    
format(stringsizeof(string), "[AdmWarning]: %s Is no longer AFK",PlayerName(playerid));
                    
ABroadCast(COLOR_YELLOW,string,1);
                    
SetPlayerHealth(playerid30);
                    
AfkTimerTimer[playerid] = 0;
                    
Delete3DTextLabel(AFKLabel[playerid]);
                    
SendClientMessage(playeridCOLOR_GREY"You are no longer in AFK mode, and you are now able to move again!");
                    
TogglePlayerControllable(playerid1);
                    
afk[playerid] = 0;
                    return 
1;
                }
            }
        }
        return 
1;
    } 
And

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

And at the Top :

PHP код:
forward AfkTimer(playerid); 



Re: Pkayer 3D Text Label :( - Thresholdold - 28.11.2011

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


Re: Pkayer 3D Text Label :( - -CaRRoT - 28.11.2011

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



Re: Pkayer 3D Text Label :( - System64 - 28.11.2011

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



Re: Pkayer 3D Text Label :( - -CaRRoT - 28.11.2011

Yeah Forgot Attach3DTextLabelToPlayer - My bad


Re: Pkayer 3D Text Label :( - Thresholdold - 28.11.2011

What do I put if I want to remove it?


Re: Pkayer 3D Text Label :( - -CaRRoT - 28.11.2011

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

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



Re: Pkayer 3D Text Label :( - Aira - 28.11.2011

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 017undefined symbol "playerid" 



Re: Pkayer 3D Text Label :( - System64 - 28.11.2011

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