AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Loop Task or Flag B (https://forums.alliedmods.net/showthread.php?t=338977)

MrPickles 08-07-2022 18:57

Loop Task or Flag B
 
I have a doubt, wich is better, a loop for a task or setting a Flag B?

PHP Code:

for ( new Float:i=1.0i<=999.0i++ )
set_taski"fxLight"Client );  

// Or

set_task1.0"fxLight"Client__"b"); 

thinking it will be infinite until i decide to remove it

jimaway 08-07-2022 19:17

Re: Loop Task or Flag B
 
1 repeating task is way better

MrPickles 08-07-2022 19:21

Re: Loop Task or Flag B
 
Quote:

Originally Posted by jimaway (Post 2785820)
1 repeating task is way better

so the task with the flag b?

and other thing:

PHP Code:

new g_variable[33// 33 is the max array, for 32 players + 1 extra slot right?
                            // but if my server have 12 slots, shouldn't it be 13? 


Natsheh 08-07-2022 19:38

Re: Loop Task or Flag B
 
Quote:

Originally Posted by MrPickles (Post 2785821)
so the task with the flag b?

and other thing:

PHP Code:

new g_variable[33// 33 is the max array, for 32 players + 1 extra slot right?
                            // but if my server have 12 slots, shouldn't it be 13? 


MAX_PLAYERS definition is not the same as MaxClients. MaxClients holds how many players the server can have at a particular time while MAX_PLAYERS is a constant that holds the maximum amount of players the server can have of clients.

MrPickles 08-07-2022 19:40

Re: Loop Task or Flag B
 
Quote:

Originally Posted by Natsheh (Post 2785823)
MAX_PLAYERS definition is not the same as MaxClients. MaxClients holds how many players the server can have at a particular time while MAX_PLAYERS is a constant that holds the maximum amount of players the server can have of clients.

so it will always be 33?

bigdaddy424 08-07-2022 21:09

Re: Loop Task or Flag B
 
Quote:

Originally Posted by MrPickles (Post 2785824)
so it will always be 33?

yes, 33 is null, 0 is server and 1 to 32 are the players

MrPickles 08-07-2022 21:20

Re: Loop Task or Flag B
 
Quote:

Originally Posted by bigdaddy424 (Post 2785826)
yes, 33 is null, 0 is server and 1 to 32 are the players

but what I don't understand, you say that from 1 to 32 are the players, that is, 1 is the first to enter and so on, until reaching 32, but what if my server has a maximum capacity of 12 players? shouldn't it be minimized?

EFFx 08-07-2022 22:12

Re: Loop Task or Flag B
 
This is what Natshed just told you about. But since we cannot change the variable size mid-game, we create them with the maximum value of players ID avaliable by the game, which is 32 players. Stick with the g_variable[33], changing to [13] won't change anything regarding your server perfomance or memory whatsoever.

MrPickles 08-07-2022 22:57

Re: Loop Task or Flag B
 
Quote:

Originally Posted by EFFx (Post 2785833)
This is what Natshed just told you about. But since we cannot change the variable size mid-game, we create when with the maximum value of players ID avaliable by the game, which is 32 players. Stick with the g_variable[33], changing to [13] won't change anything regarding your server perfomance or memory whatsoever.

Thank U!


All times are GMT -4. The time now is 15:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.