SA-MP Forums Archive
[HELP] 3D Text Labels on player's Body +REP 1 - 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: [HELP] 3D Text Labels on player's Body +REP 1 (/showthread.php?tid=480300)



[HELP] 3D Text Labels on player's Body +REP 1 - VenomMancer - 09.12.2013

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



Re: [HELP] 3D Text Labels on player's Body +REP 1 - SickAttack - 09.12.2013

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 .


Re: [HELP] 3D Text Labels on player's Body +REP 1 - VenomMancer - 09.12.2013

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 ?


Re: [HELP] 3D Text Labels on player's Body +REP 1 - Tayab - 09.12.2013

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


Re: [HELP] 3D Text Labels on player's Body +REP 1 - SickAttack - 10.12.2013

Sorry again ;(

I posted the code in my previous post.


Re: [HELP] 3D Text Labels on player's Body +REP 1 - VenomMancer - 10.12.2013

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 ?


Re: [HELP] 3D Text Labels on player's Body +REP 1 - SickAttack - 10.12.2013

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;
}