[HELP] 3D Text Labels on player's Body +REP 1
#1

Hello can you help me make 3D text Labels on player's Body ?
because i have GM and have team.

The team is :
-Zombie team
-Admin team (only admin can use)
-Cop team
- etc..

So, i want when the player select team, and when player spawn, the player have 3D text labels on their body.
If the player use Zombie team, on his body have 3D txt labels "ZOMBIE TEAM" .


If you understant, please help me

If i helped i will give you +REP 1
Reply
#2

Hello.

Parameters:
(Text3D:id, playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ)

Text3D:id - The ID of the 3D Text label to attach.
playerid - The ID of the player to attach the 3D text label to.
OffsetX - The X offset from the player.
OffsetY - The Y offset from the player.
OffsetZ - The Z offset from the player.

Код:
new Team_Zombie[MAX_PLAYERS];
new Team_Admin[MAX_PLAYERS];
new Team_Cop[MAX_PLAYERS];

public OnGameModeInit()
{
        AddPlayerClass(162,1682.0084,-1353.8291,159.6641,223.8957,0,0,0,0,0,0); // Zombie
	AddPlayerClass(163,1958.3783, 1343.1572, 15.3746, 269.1425,3,1,22,50,29,500); // Admin
	AddPlayerClass(267,1958.3783, 1343.1572, 15.3746, 269.1425,3,1,22,50,29,500); // Cop
        return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
        switch (classid)
	{
		case 0: // Zombie Team
 		{
                       Team_Zombie[playerid] =1;
                       Team_Admin[playerid] =0;	
                       Team_Cop[playerid] =0; 
		}
		case 1: // Admin Team
 		{
                       Team_Admin[playerid] =1;
                       Team_Zombie[playerid] =0;	
                       Team_Cop[playerid] =0; 	    
		}
		case 2: // Cop Team
 		{
                       Team_Cop[playerid] =1;
'                      Team_Admin[playerid] =0;	
                       Team_Zombie[playerid] =0;  		    
		}
        }
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
        if(Team_Admin[playerid] == 1)
        {
              if(!IsPlayerAdmin(playerid))
              {
                    SendClientMessage(playerid,0xFFFFFFFF,"You may not spawn. Admins Only!");
                    return 0;
              }
              return 1;
        }
        return 1;
}

public OnPlayerSpawn(playerid)
{
        if(Team_Zombie[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("Zombie Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Zombie Team.");
              return 1;
        }
        if(Team_Admin[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("Admin Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Admin Team.");
              return 1;
        }
        if(Team_Cop[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("Cop Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Cop Team.");
              return 1;
        }
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        Team_Zombie[playerid] =0; 
        Team_Admin[playerid] =0; 
        Team_Cop[playerid] =0; 
        return 1;
}
Edit: Sorry, i accidentally posted unfinished code.

Hope it helps .
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
public OnPlayerSpawn(playerid)
{
new Text3D:label = Create3DTextLabel("Zombie Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
return 1;
}
This on player's body ? Or ?
Reply
#4

It is actually on top of his head, right where the player name and health bar is.
Reply
#5

Sorry again ;(

I posted the code in my previous post.
Reply
#6

Quote:
Originally Posted by Tayab
Посмотреть сообщение
It is actually on top of his head, right where the player name and health bar is.
I want he text on player's "stomach" !

can you make it ?
Reply
#7

Add "\n" to skip one line.

Код:
new Team_Zombie[MAX_PLAYERS];
new Team_Admin[MAX_PLAYERS];
new Team_Cop[MAX_PLAYERS];

public OnGameModeInit()
{
        AddPlayerClass(162,1682.0084,-1353.8291,159.6641,223.8957,0,0,0,0,0,0); // Zombie
	AddPlayerClass(163,1958.3783, 1343.1572, 15.3746, 269.1425,3,1,22,50,29,500); // Admin
	AddPlayerClass(267,1958.3783, 1343.1572, 15.3746, 269.1425,3,1,22,50,29,500); // Cop
        return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
        switch (classid)
	{
		case 0: // Zombie Team
 		{
                       Team_Zombie[playerid] =1;
                       Team_Admin[playerid] =0;	
                       Team_Cop[playerid] =0; 
		}
		case 1: // Admin Team
 		{
                       Team_Admin[playerid] =1;
                       Team_Zombie[playerid] =0;	
                       Team_Cop[playerid] =0; 	    
		}
		case 2: // Cop Team
 		{
                       Team_Cop[playerid] =1;
'                      Team_Admin[playerid] =0;	
                       Team_Zombie[playerid] =0;  		    
		}
        }
        return 1;
}

public OnPlayerRequestSpawn(playerid)
{
        if(Team_Admin[playerid] == 1)
        {
              if(!IsPlayerAdmin(playerid))
              {
                    SendClientMessage(playerid,0xFFFFFFFF,"You may not spawn. Admins Only!");
                    return 0;
              }
              return 1;
        }
        return 1;
}

public OnPlayerSpawn(playerid)
{
        if(Team_Zombie[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("\n\n\n\nZombie Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Zombie Team.");
              return 1;
        }
        if(Team_Admin[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("\n\n\n\nAdmin Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Admin Team.");
              return 1;
        }
        if(Team_Cop[playerid] == 1)
        {
              new Text3D:label = Create3DTextLabel("\n\n\n\nCop Team", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
              Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
              SendClientMessage(playerid,0xFFFFFFFF,"You have joined the Cop Team.");
              return 1;
        }
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        Team_Zombie[playerid] =0; 
        Team_Admin[playerid] =0; 
        Team_Cop[playerid] =0; 
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)