player afk 3dtextlable problem
#5

Quote:
Originally Posted by Joe Staff
View Post
Add
Code:
Delete3DTextLabel(afklable[i]);
Just before
Code:
afklable[i] = Create3DTextLabel(str, COLOR_CYAN, 30.0, 40.0, 50.0, 40.0, 0);
Why destroy and recreate constantly if you can also just update the text?

Quote:
Originally Posted by PoniStar
View Post
alright now i have another problem , its just show for 1 person , if another player afk at the same time other guy who was esc will lose his 3dtext
Might be because of the Delete code you added. If the variable wasn't used before it will be ID 0 that gets deleted, which at that point might be a valid label for another player.

Initialize the array for each player with an invalid ID in OnPlayerConnect, eg. INVALID_3DTEXT_ID. Then in the timer, check if the ID you want to delete is valid before deleting.
When you finally delete the label when the player returns, set player's array slot to INVALID_3DTEXT_ID again.

That way you ensure no unrelated Labels get deleted.

You can also switch to Update3DTextLabelText instead of recreating so this wouldn't be a problem.
Reply


Messages In This Thread
player afk 3dtextlable problem - by PoniStar - 17.11.2018, 15:45
Re: player afk 3dtextlable problem - by Joe Staff - 17.11.2018, 16:59
Re: player afk 3dtextlable problem - by PoniStar - 17.11.2018, 17:25
Re: player afk 3dtextlable problem - by PoniStar - 17.11.2018, 17:48
Re: player afk 3dtextlable problem - by NaS - 17.11.2018, 18:16
Re: player afk 3dtextlable problem - by Joe Staff - 17.11.2018, 18:44
Re: player afk 3dtextlable problem - by PoniStar - 17.11.2018, 18:50
Re: player afk 3dtextlable problem - by PoniStar - 17.11.2018, 19:03

Forum Jump:


Users browsing this thread: 1 Guest(s)