The whole debate over player-textdraws not needing arrays..
#1

..is over. Here's solid proof.

http://pastebin.com/Nt14V7D8

To test it, you need to join as two people, playerid 0 and 1. The order of the textdraws being created is changed, playerid 0 has the textdraws created as A B C, but playerid 1 has them created as C A B. The B textdraw is ID 1 for playerid 0, BUT it is ID 2 for playerid 1. Different ids. You can't store different IDs in a single variable - YOU NEED AN ARRAY.

But then you might argue BUT MP2 THERE'S A PLAYERID PARAMETER - it does not matter. It still works on IDs. Each player can have an ID 0 player-textdraw.

I made this due to Southclaw editing the wiki with false information - clearly not having tested this.

There's also a command (you'll need zcmd) in the test mode - /delb. This deletes textdraw 'B' for the player. Try it on both playerids - it will delete C for playerid 0.
Reply
#2

You can't proof this by only one example. Maybe it accidently finished in this way. There wouldn't be debate if there didn't exist a problem, don't you think? If you are right, why others, who claim textdraws need arrays, can't find mistakes in their codes. ( I would underline that there are many of them, not just few )
Reply
#3

Then explain me this:



2 players, 2 player textdraws (one for each player obv.), same textdraw ID. Both players clicked on the playertextdraw shown on their screen, both playertextdraws returned textdraw ID 0. I changed the text of the textdraw for ID 0, the text of ID 1 stays the same.

Script used: http://pastebin.com/nybJBARE
Reply
#4

So what is you final conclusion now? Is there a [MAX_PLAYER] array needed or not?
Reply
#5

Exactly my point, ******. People create a few textdraws on player connect - thus them having the same IDs. I guess you don't need an array for the textdraws that are always created for a player, but that doesn't change the fact that they CAN be different for each player.


Quote:
Originally Posted by Drebin
Посмотреть сообщение
So what is you final conclusion now? Is there a [MAX_PLAYER] array needed or not?!
In most cases. As I just said in this post, if a player-textdraw is ALWAYS created for a player (created under OnPlayerConnect and never destroyed) then you don't need an array.

(NOTE: Player-textdraws are automatically destroyed on disconnect).


Quote:
Originally Posted by Roko_foko
Посмотреть сообщение
You can't proof this by only one example. Maybe it accidently finished in this way. There wouldn't be debate if there didn't exist a problem, don't you think? If you are right, why others, who claim textdraws need arrays, can't find mistakes in their codes. ( I would underline that there are many of them, not just few )
1. I can. Why are more needed?
2. Computers don't do things 'accidentally', they do what you instruct them to do.
3. There's a debate because some people are (frankly) stupid (no offense).
4. People that don't use an array and don't have a mistake are just 'lucky'.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
I didn't even know there WAS a debate about this!
https://sampforum.blast.hk/showthread.php?tid=336460
Reply
#7

I created those wiki pages (for the player-textdraw functions) right after they were added in the 0.3e RC stage - before even using them myself. I guessed how they worked and shouldn't have. Perhaps this could have all been avoided if I had researched!
Reply
#8

Yeah but I was still confused about it, as are others, hence the 'debate'. I did mess up on one page though (alignment) and didn't use an array - which is the root of the topic that MadeMan linked to.

Oh well, now we all know.
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
1. I can. Why are more needed?
2. Computers don't do things 'accidentally', they do what you instruct them to do.
3. There's a debate because some people are (frankly) stupid (no offense).
4. People that don't use an array and don't have a mistake are just 'lucky'.
You are right MP2. I thought you are supporting the other side. My bad. I haven't read it correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)