[HELP] This function doesn't update or I've failed on making it
#1

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
        PlayerNameTag[playerid] = CreatePlayer3DTextLabel(i, name , COLOR_WHITE , pX, pY, pZ+0.1,20.0, playerid, INVALID_VEHICLE_ID, 1);
}
This works, it creates a 3DTextLabel for player, but when I try to change it with UpdatePlayer3DTextLabelText, somehow it doesn't update it, or maybe, I've failed to use it properly?

Here's the code.

pawn Код:
UpdatePlayer3DTextLabelText(playerid, PlayerNameTag[playerid], COLOR_LIGHTBLUE, string);
Question,

pawn Код:
CreatePlayer3DTextLabelText(playerid, text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, attachedplayer, attachedvehicle, testLOS)
pawn Код:
UpdatePlayer3DTextLabelText(playerid, PlayerText3D:id, color, text[])
Question, on CreatePlayer3DTextLabelText, there are 2 parameters for player. 1st one (playerid) is The player which should see the newly created 3DText Label, and the second one is (attachedplayer) is The player you want to attach the 3D Text Label to.

My Question, on UpdatePlayer3DTextLabelText, would the playerid be 1st Parameter in the creating function (playerid) or would it be 2nd parameter which is (attachedplayer)?

2nd Question,

Regarding the TestLOS, which one would let the text NOT to go through walls?

Thanks for helping.
Reply
#2

1st question:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
        PlayerNameTag[i] = CreatePlayer3DTextLabel(i, name , COLOR_WHITE , pX, pY, pZ+0.1,20.0, playerid, INVALID_VEHICLE_ID, 1);
}
PlayerNameTag was assigned to playerid, instead if i.
Second question: Maybe the value should be 0 to disable viewing through walls.
Reply
#3

What you're doing is pointless anyways. Let's say there are 50 players online. It will loop through them and it will assign to PlayerNameTag[playerid] again and again, but it will only keep the last ID of 3D Label.
Reply
#4

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
1st question:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
        PlayerNameTag[i] = CreatePlayer3DTextLabel(i, name , COLOR_WHITE , pX, pY, pZ+0.1,20.0, playerid, INVALID_VEHICLE_ID, 1);
}
PlayerNameTag was assigned to playerid, instead if i.
Second question: Maybe the value should be 0 to disable viewing through walls.
playerid The player which should see the newly created 3DText Label.
text[] The text to display.
color The text color
x X Coordinate (or offset if attached)
y Y Coordinate (or offset if attached)
z Z Coordinate (or offset if attached)
DrawDistance The distance where you are able to see the 3D Text Label
attachedplayer The player you want to attach the 3D Text Label to. (None: INVALID_PLAYER_ID)
attachedvehicle The vehicle you want to attach the 3D Text Label to. (None: INVALID_VEHICLE_ID)
testLOS 0/1 Test the line-of-sight so this text can't be seen through walls


Its different from what I was told on wiki.


Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
What you're doing is pointless anyways. Let's say there are 50 players online. It will loop through them and it will assign to PlayerNameTag[playerid] again and again, but it will only keep the last ID of 3D Label.
Where do you think I'm putting it at, sir? It's somewhere after the player is logged in, not OnPlayerUpdate or etc etc.
it would do a loop for every after a player is logged in, so the player can see the user's name.
Reply
#5

Quote:
Originally Posted by Ahrim
Посмотреть сообщение
Where do you think I'm putting it at, sir? It's somewhere after the player is logged in, not OnPlayerUpdate or etc etc.
it would do a loop for every after a player is logged in, so the player can see the user's name.
You did not understand what I said. The problem is not the loop, I didn't even mention OnPlayerUpdate like you did.

I'm saying that the variable you use to store the ID of the Player 3D Label will store only the ID from the last player. Also it'd be good to check if the player are connected to for loops.

PS: I think about testLOS that 0 is disable.
Reply
#6

I bet you know what does for().
Playerid, as wiki sais, is the player who gets the attached label.
For loops through all player IDs, but now it is not anymore playerid, but i.
So "i" replaces playerid for all players.
Edit: As far as I know, player3dtextlabels should calculate the position by themselves, so you shouldn't get the player's position and assign it to the coordinates. Just set x to 0.0, y to 0.0 and z to 1.0.
Reply
#7

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
I bet you know what does for().
Playerid, as wiki sais, is the player who gets the attached label.
For loops through all player IDs, but now it is not anymore playerid, but i.
So "i" replaces playerid for all players.
Edit: As far as I know, player3dtextlabels should calculate the position by themselves, so you shouldn't get the player's position and assign it to the coordinates. Just set x to 0.0, y to 0.0 and z to 1.0.


no :c Playerid is the player who SEES the new label.
attachedplayer is the one who gets the label on them?
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You did not understand what I said. The problem is not the loop, I didn't even mention OnPlayerUpdate like you did.

I'm saying that the variable you use to store the ID of the Player 3D Label will store only the ID from the last player. Also it'd be good to check if the player are connected to for loops.

PS: I think about testLOS that 0 is disable.
I didnt set PlayerNameTag[playerid] as PlayerNameTag[ i ]

Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You did not understand what I said. The problem is not the loop, I didn't even mention OnPlayerUpdate like you did.

I'm saying that the variable you use to store the ID of the Player 3D Label will store only the ID from the last player. Also it'd be good to check if the player are connected to for loops.

PS: I think about testLOS that 0 is disable.
I've tried that, if I do it to players that are just connected, they can see my text, but I cant see theirs.
Reply
#10

Quote:
Originally Posted by Ahrim
Посмотреть сообщение
I didnt set PlayerNameTag[playerid] as PlayerNameTag[ i ]
You're missing the point. An example:
pawn Код:
new
    num
;
for( new j = 0; j < 50; j++ ) num = j;
It re-assigns a value to num, but num will keep the last one after it finishes. So it will keep only the 49.
In other words, the other 48 were pointless.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)