SA-MP Forums Archive
3d Text Labels Question - 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 Labels Question (/showthread.php?tid=572767)



3d Text Labels Question - DanLore - 01.05.2015

Edit: Starting to think this a problem caused elsehwere, since I have been debugging this today. Still, if there are any noticeable issues with my labels any feedback is very much appreciated.

Hi,

I'm using 3d text labels but I'm having an issue where labels seem to overwrite each other, I was wondering if I'm doing it wrong.

I'm using enums for each of the sets of data.

PHP код:
enum wData
{
    
Text3D:wLabel

PHP код:
enum dData
{
    
Text3D:GunLabel

Let's say I create my first label with wData.

PHP код:
thisData[slotToUse][wLabel] = Create3DTextLabel... etc 
then my second with dData.

PHP код:
dInfo[i][GunLabel] = Create3DTextLabel... etc 
Now am I confused with how the label system works here? Are these label ids able to conflict?

To update my labels I'm using the following.

PHP код:
Update3DTextLabelText(thisData[i][wLabel], COLOR_WHITElabelText); 
To delete I'm using the following.

PHP код:
Delete3DTextLabel(thisData[i][wLabel]); 
The problem is sometimes the data from dData will appear in wData's text labels.

Is this an issue or is the problem occurring elsewhere in my code?
Thanks for any replies.


Re: 3d Text Labels Question - Alpay0098 - 01.05.2015

Can you show us more code If it's possible please ...


Re: 3d Text Labels Question - DanLore - 01.05.2015

Quote:
Originally Posted by Alpay0098
Посмотреть сообщение
Can you show us more code If it's possible please ...
I'll take some code from my system here.

First I create my text label.

PHP код:
new labelText[128];
format(labelTextsizeof(labelText), "{FFFFFF}Planted by %s; ID %i\n{FE642E}0 Percent Completed\n{FFFFFF}/seizeweed"GetUserName(playerid), individualSlot);
weedData[slotToUse][weedLabel] = Create3DTextLabel(labelTextCOLOR_YELLOWweedData[slotToUse][weedPosition][0], weedData[slotToUse][weedPosition][1], (weedData[slotToUse][weedPosition][2] - 0.5), 30GetPlayerVirtualWorld(playerid), 0); 
Next I update my label.

PHP код:
format(labelTextsizeof(labelText), "{FFFFFF}Planted by %s; ID %i\n{58D3F7}ready to /harvest\n{FFFFFF}/seizeweed"GetUserName(weedData[i][weedOwner]), iweedData[i][weedStatus]);
Update3DTextLabelText(weedData[i][weedLabel], COLOR_WHITElabelText); 
Finally I delete my label.

PHP код:
Delete3DTextLabel(weedData[i][weedLabel]); 
Now all this works fine, but let's say there are 4 systems using labels, weed, bombs, cars, etc.. How do I ensure these do not conflict? Hopefully you understand.


Re: 3d Text Labels Question - Mencent - 01.05.2015

Hello!

We need all rows of your labels (also the enum..).
Please share these.


Re: 3d Text Labels Question - J0sh... - 01.05.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
(also the enum..).
Please share these.
Did you read the main post?


Re: 3d Text Labels Question - Mencent - 01.05.2015

Yes, but he told about 4 different labels.
And where are the labels here?
PHP код:
enum wData 

    
Text3D:wLabel 




Re: 3d Text Labels Question - DanLore - 01.05.2015

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

We need all rows of your labels (also the enum..).
Please share these.
Sure.

PHP код:
enum dData
{
    
dropAmmo[2],
    
Float:DropPosX,
    
Float:DropPosY,
    
Float:DropPosZ,
    
DropVWorld,
    
DropInterior,
    
DropOwner,
    
Text3D:GunLabel
}; 
PHP код:
enum wData
{
    
weedID,
    
weedOwner,
    
weedTime,
    
weedObject,
    
weedSlot,
    
weedStatus,
    
weedUpdated,
    
Float:weedPosition[3],
    
Text3D:weedLabel

PHP код:
enum rInfo
{
    
sCreated,
    
Float:sX,
    
Float:sY,
    
Float:sZ,
    
sObject,
    
copid,
    
Text3D:rbLabel
}; 
and for example when deleting I use this code.

PHP код:
forward destroyWeed(tweedID);
public 
destroyWeed(tweedID)
{
    
weedData[tweedID][weedOwner]             = INVALID_WEED_ID;
    
weedData[tweedID][weedSlot]            = INVALID_WEED_ID;
    
weedData[tweedID][weedTime]             = INVALID_WEED_ID;
    
weedData[tweedID][weedStatus]             = INVALID_WEED_ID;
    
weedData[tweedID][weedUpdated]         = INVALID_WEED_ID;
    
weedData[tweedID][weedPosition][0]         = 0.0000;
    
weedData[tweedID][weedPosition][1]         = 0.0000;
    
weedData[tweedID][weedPosition][2]        = 0.0000;
    
    
Delete3DTextLabel(weedData[tweedID][weedLabel]);
    
DestroyDynamicObject(weedData[tweedID][weedObject]);
    return 
1;