Need a advice about creating textdraws using strings and arrays
#1

What could be better to use?
Creating the textdraw at OnGameModeInit using a loop

pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        mytexdraw[i] = TextDrawCreate...etc
    }
}
or at OnPlayerConnect?

pawn Код:
public OnPlayerConnect(playerid)
{
    mytexdraw[playerid] = TextDrawCreate...etc
}
Thanks, regards.
Reply
#2

I think it is better OnPlayerCOnnect...Becouse if you load them under gamemodeinit it will take more server resources than in OnPlayerConnect. And it will definitly use more textdraws aswell. E.g you don't have constant..mm lets say 50 players, considering that you have 50 slot server...So yes, construct them under OnPlayerConnect

actiwe
Reply
#3

Quote:
Originally Posted by actiwe
Посмотреть сообщение
I think it is better OnPlayerCOnnect...Becouse if you load them under gamemodeinit it will take more server resources than in OnPlayerConnect. And it will definitly use more textdraws aswell. E.g you don't have constant..mm lets say 50 players, considering that you have 50 slot server...So yes, construct them under OnPlayerConnect

actiwe
On Player Connect
Reply
#4

depends the amount of textdraws and the amount of connections per minute.
Reply
#5

For now its only 6 textdraws and i am planing a 100 player slot server for the start.
Reply
#6

Quote:
Originally Posted by actiwe
Посмотреть сообщение
I think it is better OnPlayerCOnnect...Becouse if you load them under gamemodeinit it will take more server resources than in OnPlayerConnect. And it will definitly use more textdraws aswell. E.g you don't have constant..mm lets say 50 players, considering that you have 50 slot server...So yes, construct them under OnPlayerConnect

actiwe
What are you on about, this is a terrible idea.


First of all, there's no way it can use more resources, in the end they WILL use the same amount of resources. There are two critical reasons why i chose loading them under OnGameModeInit.

1. You arent making assumptions. If your going to use the OnPlayerConnect method, make sure you account for 500 textdraws. Plan and simple. Assumptions are very bad, especially when there are limits in place.

2. Creating them when the GM starts also means that its DONE, you dont have to do it during runtime. This means that the server has 1 less task to do during runtime (which is good, the less the server has to do/wait for the better, this gives it time to synch etc).

So i think the obvious choice is creating the under OnGameModeInit! If the OnPlayerConnect method uses the same amount of resources as the OnGameModeInit one, why use a method that gives the server more work to do?


Im willing to debate this, but honestly i can see the good in creating them under OnPlayerConnect at all.
Reply
#7

That sounds logical, thanks.
Reply
#8

No problem man, if you have any other questions like this, feel free to PM me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)