SA-MP Forums Archive
[3dTextLabels] Using a string - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [3dTextLabels] Using a string (/showthread.php?tid=156639)



[3dTextLabels] Using a string - KnooL - 23.06.2010

Hi sa-mp,

Appearently whenever I use a string in a 3DTextLabel, it's simply not showing up.
Does anyone know a reason why it isn't working?

Here a bit of the code (simply all of it ):
pawn Код:
new name[128];
pawn Код:
if(HouseInfo[houseid][hSellable] == 1){
            HouseInfo[houseid][hPickup] = CreatePickup(1273, 23, HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]); // not bought
            HouseInfo[houseid][hText] = Create3DTextLabel("House for sale",COLOR_GREEN,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);
        } else {
            HouseInfo[houseid][hPickup] = CreatePickup(1272,23, HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]); // bought
            format(name,sizeof(name),"%s's House",HouseInfo[houseid][hName]);
            HouseInfo[houseid][hText] = Create3DTextLabel(name,0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);
        }
The 'House for sale' label is working on every house non-bought.
The other label is not working on any house.

Screenshots:



Thank you for helping me fixing this in advance,

KnooL


Re: [3dTextLabels] Using a string - jonrb - 23.06.2010

is the variable "name" too small?


Re: [3dTextLabels] Using a string - Jofi - 23.06.2010

Have you tried whitout "name" variable like,

Quote:

HouseInfo[houseid][hText] = Create3DTextLabel("Bought House",0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);

Does it work if you make it like that?

I know you need to use "name" but how about try that and then tell does it work
And ofc you need delete & make new textlabel when someone buy or sell that house.


Re: [3dTextLabels] Using a string - NiiRV4N4 - 23.06.2010

Loop all of the houses then use JoFi's code expect replace houseid with i. Make sure the string is big enough.


Re: [3dTextLabels] Using a string - KnooL - 23.06.2010

Quote:
Originally Posted by » JoFi »
Have you tried whitout "name" variable like,

Quote:

HouseInfo[houseid][hText] = Create3DTextLabel("Bought House",0x8D8DFF00,HouseInfo[houseid][hExitX], HouseInfo[houseid][hExitY], HouseInfo[houseid][hExitZ]+2,40.0,0);

Does it work if you make it like that?

I know you need to use "name" but how about try that and then tell does it work
And ofc you need delete & make new textlabel when someone buy or sell that house.
Ofcourse I have set to update the label when bought or sold.

Without the formatted string it works without a bug.

Quote:
Originally Posted by jonrb
is the variable "name" too small?
Код:
MAX_PLAYER_NAME = 24 
STRING = 9
MAX_PLAYER_NAME + STRING = 33
Formatted string (name) = 128

Quote:
Originally Posted by NiiRV4N4
Loop all of the houses then use JoFi's code expect replace houseid with i. Make sure the string is big enough.
The loop is using the variable houseid, no need to change that. Also JoFi's reply contains a non-formatted string which resolves the problem, but not the way I want it to have.



Re: [3dTextLabels] Using a string - Jofi - 23.06.2010

What you have in "new 3DText:"


Re: [3dTextLabels] Using a string - KnooL - 16.07.2010

pawn Код:
new PlayerText3D: SpeedText[MAX_PLAYERS];