3d text label
#1

I want to make it to where when the player types /plant, it will make a 3D text label with the "COL_PURPLE" above their head saying, "* %s plants cannabis seeds." I tried a few ways of doing this, but I'm not experienced enough. Can someone help me out with this issue?

PHP код:
CMD:plant(playeridparams[])
{
    if(
PlayerInfo[playerid][pSeeds] > 2
    { 
    new 
Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z,string[128];
    
GetPlayerName(playerid,Namesizeof(Name));
    
GetPlayerPos(playerid,x,y,z);
    
CreateObject(19473,x,y,z-2,0,0,0);
    
PlayerInfo[playerid][pSeeds]-=3;
    }
    else
    
SendClientMessage(playerid,COL_WHITE,"You don't have enough seeds!");
    return 
1;

Reply
#2

somewhere on top

new PlayerText3D:seedtext;

PHP код:
CMD:plant(playeridparams[])
{
    if(
PlayerInfo[playerid][pSeeds] > 2
    { 
    new 
Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z,string[128];
    
GetPlayerName(playerid,Namesizeof(Name));
    
GetPlayerPos(playerid,x,y,z);
    
format(string,sizeof(string),"%s plants canabis seeds",Name);
    
seedtext CreatePlayer3DTextLabel(playerid,string,COL_PURPLE,X,Y,Z+2.5,40.0);
    
SetTimerEx("SeedTextOver",5000,false,"d",playerid);
    
SetTimerEx
    CreateObject
(19473,x,y,z-2,0,0,0);
    
PlayerInfo[playerid][pSeeds]-=3;
    }
    else
    
SendClientMessage(playerid,COL_WHITE,"You don't have enough seeds!");
    return 
1;
}
forward SeedTextOver(playerid);
public 
SeedTextOver(playerid)
{
     
DeletePlayer3DTextLabel(playerid,seedtext);

Reply
#3

Don't know why you would want a 3DTextLabel, the best way to do this would be with a chat bubble. The chat bubble is probably what you actually wanted but you mistook it for a 3DTextLabel. It does the same thing but it goes away by itself without being destroy. Here is the wiki link: https://sampwiki.blast.hk/wiki/SetPlayerChatBubble

And here is the code:

pawn Код:
CMD:plant(playerid, params[])
{
    if(PlayerInfo[playerid][pSeeds] > 2)  
    {  
        new Name[MAX_PLAYER_NAME],Float:x,Float:y,Float:z,string[128];
        GetPlayerName(playerid, Name, sizeof(Name));
        format(string, sizeof(string), "%s plants some canabis seeds.", Name);
        SetPlayerChatBubble(playerid, string, COL_PURPLE, 100, 2000);
        GetPlayerPos(playerid,x,y,z);
        CreateObject(19473,x,y,z-2,0,0,0);
        PlayerInfo[playerid][pSeeds]-=3;
    }
    else return SendClientMessage(playerid,COL_WHITE,"You don't have enough seeds!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)