Id 3d text
#1

im sure this is easy but im having trouble im trying to disable the name tag for players and enable a 3d text above their head that shows just id.

this is what i have so far ]

Код:
		new Text3D:label = Create3DTextLabel("%d",playerid, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
		for(new i = 0; i < MAX_PLAYERS; i++) Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
but this doesnt work i also tried to define idname = GetPlayerid(playerid), but of cour4se that didnt work either i think im missing making the id into a string so it can print it

thanks i know it is a simple fix
Reply
#2

i just need help setting the Create3Dtextlabel to start with the players id !!!! please help
Reply
#3

https://sampwiki.blast.hk/wiki/Format
https://sampwiki.blast.hk/wiki/Loops
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer

1) You need to create the variable into an array so it haves data for each one of the players.
2) Formatting something (%d, %s, etc) does not work like that in functions. Refeer to the first link.
3) Refeer to the second link for loops explanations, they don't work like you've typed.
4) Check for reference the last link.
Reply
#4

ok if im not able to use a placeholder in the Create3dTextLabel how would i insert the players id into the place i need theplayer id
and is this a good start?


new result[128];
new number = GetPlayerId(GetPlayerName(playerid));
format(result,sizeof(result), "%i.",number);
Reply
#5

1) playerid is just a numeric variable that in all the (native) callbacks it holds the ID of the player that called it. Doing GetPlayerId(playerid) is just.. pointless, because playerid is the ID.
2) GetPlayerName needs a destination array. Check the wiki again.

You did format it correctly, though.
Reply
#6

From what im reading and if im reading it correctly you mean somethingm ore like this??

Код:
new result[128];
new number[MAX_PLAYERS] = playerid; // at this part im trying to get the playerid , so doing this since                    playerid is a variable it should print the id correctly????
format(result,sizeof(result), "%i.",number); 
new Text3D:PlayerLabel[MAX_PLAYERS];
PlayerLabel = Create3DTextLabel(result, 0xFFFFFFAA, 10.0, 20.0, 40.0, 20.0, 0);
Attach3DTextLabelToPlayer(PlayerLabel, playerid, 0.0, 0.0, 0.7);
trying to compile i got these errors

DM.pwn(76) : error 008: must be a constant expression; assumed zero
DM.pwn(79) : error 033: array must be indexed (variable "PlayerLabel")
DM.pwn(80) : error 035: argument type mismatch (argument 1)
Reply
#7

I recommend reading more and putting effort on investigation before attempting to make such things.

This is how it is actually done:

pawn Код:
//somewhere outside any function
new Text3D:Label[MAX_PLAYERS]; //create a global array with 500 cells so you can use one per player


new str[5];
format(str, sizeof str, "%d", playerid); //format the string
Label[playerid] = Create3DTextLabel(str, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0); //create the label, save it's ID in the array for each player
Attach3DTextLabelToPlayer(Label[playerid], playerid, 0.0, 0.0, 0.7); //just attach the label
playerid = a variable which is also an integer, in most of the native callbacks it represents the ID of the player that called said callback.
Reply
#8

ok i fixed the error 033 and error 35.
any ideas n error 008 ]
heres what ai did to fix last two errors


Код:
	new result[128];
		new number[MAX_PLAYERS] = playerid; // at this part im trying to get the playerid , so doing this since                    playerid is a variable it should print the id correctly????
		format(result,sizeof(result), "%i.",number); 
		new Text3D:PlayerLabel[MAX_PLAYERS];
		PlayerLabel[playerid] = Create3DTextLabel(result, 0xFFFFFFAA, 10.0, 20.0, 40.0, 20.0, 0);
		Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid, 0.0, 0.0, 0.7);
Reply
#9

https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)