Textdraw Display Problem
#1

Hi there ! I have a problem, but i have no idea why it is appearing. All the textdraws is working properly until the server gets 149 players ( 150 ids ). Then, the players who has id above 149 ( 150,151,152..) can't see the textdraws. it will not appear for them. Why? If i use MAX_PLAYERS, the textdraws are not display for anyone. I can't understand why.
Reply
#2

Can you show us some parts of the code that shows the creation of the textdraws?
Reply
#3

Quote:
Originally Posted by DTV
Посмотреть сообщение
Can you show us some parts of the code that shows the creation of the textdraws?
Sure, look at:
Код HTML:
for(new f = 0; f < MAX_PLAYERS; f++)
{
        HPText[f] = TextDrawCreate(498.000000, 100.000000, "Since 2014");
		TextDrawLetterSize(HPText[f], 0.299999,1.200000);
		TextDrawAlignment(HPText[f], 2);
		TextDrawColor(HPText[f], -1);
		TextDrawSetShadow(HPText[f], 1);
		TextDrawSetOutline(HPText[f], 1);
		TextDrawBackgroundColor(HPText[f], 51);
		TextDrawFont(HPText[f], 1);
		TextDrawSetProportional(HPText[f], 1);
}
This type for all of them. It is inserted to ONGAMEMODEINIT. If i will put it on ONPLAYERCONNECT it is not displayed for the beggining.


P.S.: I tried to add again
Код HTML:
#undef MAX_PLAYERS
#define MAX_PLAYERS 500
and the timers are stuck. JailTime is stuck as well etc. Why? If I remove define MAX_PLAYERS is working properly.I can't understand
Reply
#4

If the above textdraw has the same text "Since 2011" for all the players, an array in that case is not needed at all.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If the above textdraw has the same text "Since 2014" for all the players, an array in that case is not needed at all.
I use that textdraw to show for all the admins how many reports are active. So, I use :
Код HTML:
[HTML]
TextDrawSetString(HPText[i], string2);
			TextDrawShowForPlayer(i, HPText[i]);
[/HTML]
It must be an array,no?
Reply
#6

The point was that textdraws that have the same text for all the players must be global textdraws and all the rest per-player textdraws. This is what you should use: https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
If the player is an admin after logging in, create the textdraw with the appropriate text for that player only and show it.
Reply
#7

Ok. It could be a cause for that if I am using the textdraws as an array?

1For example, i am using 2 textdraws for logo, 2 textdraws for clock and date. So, I can make them global because is showed for all the players anyway, no?
. I will use an array just if I want to show for some players.

2. Why the textdraws is now displayed for anyone if I put them in ONPLAYERCONNECT from ONGAMEMODEINIT?

3. I tried to change it:
Код HTML:
Clock1[f] = TextDrawCreate(498.000000,10.000000,"8.05.2015");
		TextDrawAlignment(Clock1[f],0);
		TextDrawBackgroundColor(Clock1[f],BLACK);
		TextDrawFont(Clock1[f],3);
		TextDrawLetterSize(Clock1[f],0.43,1.0);
		TextDrawColor(Clock1[f], -1);
		TextDrawSetOutline(Clock1[f],1);
		TextDrawSetProportional(Clock1[f],1);
		TextDrawSetShadow(Clock1[f],1);
to:
Код HTML:
Clock1[f] = CreatePlayerTextDraw(f, 498.000000,10.000000,"8.05.2015");
		PlayerTextDrawAlignment(f, Clock1[f],0);
		PlayerTextDrawBackgroundColor(f, Clock1[f],BLACK);
		PlayerTextDrawFont(f, Clock1[f],3);
		PlayerTextDrawLetterSize(f, Clock1[f],0.43,1.0);
		PlayerTextDrawColor(f, Clock1[f], -1);
		PlayerTextDrawSetOutline(f, Clock1[f],1);
		PlayerTextDrawSetProportional(f, Clock1[f],1);
		PlayerTextDrawSetShadow(f, Clock1[f],1);
but it is displayed in the wrong positions now...
Reply
#8

By the way you explained the problem I'm perfectly sure you are hitting the 2k global textdraw limit, If you are making a textdraw different for each player use PlayerTextdraws not normal textdraws, you can have 256 playertextdraws (for each player) and 2k global textdraws.

Edit: I guess Konstantinos beat me to it this tab was open for a long time and I just noticed it.
Reply
#9

You code actually would work, it was just that there would be many textdraws created with the same text when it can be done with only 1 so you will not waste more.

The logo will not change and if it does, it will be for all the players so global.
The clock and date is same for every player? If yes, global. Otherwise, per-player textdraw.

As for the positions, I don't think there would be a problem. The coordinates of the screen are the same, it only creates a textdraw that is visible for a single player only. Do not use a loop for that, you got "playerid" already for CreatePlayerTextDraw.
Reply
#10

I want to change the loop with playerid but i can't. In ongamemodeinit it is not defined and if i will put the texdraws in onplayerconnect there are not displayed.

I think that is a problem because i am using them as an array for each player. I remember that a few months ago i had more textdraws and the problem was appearing to 50 players. I deleted some textdraws and now it is appearing to 150 players connected. Why not to 157 or 162 etc but exactly to 151th player connected or more than.... this is weird. I try to optimize them and i will be back..

But what's about MAX_PLAYERS? Why it stuck the timers (jailtime, paintball time etc) if i define it?
Thanks and sorry for my bad english.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)