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: 3d text label (
/showthread.php?tid=408929)
3d text label -
Noles2197 - 19.01.2013
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(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));
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;
}
AW: 3d text label -
Harry :) - 19.01.2013
somewhere on top
new PlayerText3D:seedtext;
PHP код:
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));
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);
}
Re: 3d text label -
Chenko - 19.01.2013
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;
}