Hi Pat!
The following player-threads are always "created". Could we optimize this part a bit?
// start toolbox procedures
self thread extreme\_ex_toolbox::main();
// monitor for knife
self thread extreme\_ex_knife::main();
// monitor for flamethrower
self thread extreme\_ex_flamethrower::main();
// display round number at spawn for roundbased gametypes
self thread roundDisplay();
For example:
Toolbox:
//********************************************************************************
//{NADF} Toolbox Fix
//********************************************************************************
//Created by: {NADF}Geronimo
//Date: 19.06.2011
//Version: 1.0
//Website: http://nadfserver.org
//Clan: {NADF} - North Atlantic Defence Force
//Comment: NADF FIX to reduce player threads!
//********************************************************************************
if (level.ex_nadf_toolbox) self thread extreme\_ex_toolbox::main();
//********************************************************************************
Add a level-variable to turn on/off that feature. In that way, the player-names for the toolbox can always be added in the file.
Also it helps to reduce a bit of spawning-player-threads.
level endon("ex_gameover");
self endon("disconnect");
authplayers = [];
// Enable the tools for the following players (include color codes)
authplayers[authplayers.size] = "playername";
// Enable the tools you need (preferably only enable one at a time)
tool_thirdperson = true;
tool_showpos = false;
// No need to change anything below this line
tool_authorized = false;
//********************************************************************************
This code is always used...
KNIFE:
If it's not correct, could you please post the correct way?
//********************************************************************************
//{NADF} Knife Fix
//********************************************************************************
//Created by: {NADF}Geronimo
//Date: 19.06.2011
//Version: 1.0
//Website: http://nadfserver.org
//Clan: {NADF} - North Atlantic Defence Force
//Comment: NADF FIX to reduce player threads!
//********************************************************************************
if (level.ex_wepo_sidearm > 1 && getCvarInt("scr_allow_knife") != 0) self thread extreme\_ex_knife::main();
//********************************************************************************
Flamethrower
Similary to the knife, we never use them, but the player-thread is started.
//********************************************************************************
//{NADF} Flamethrower Fix
//********************************************************************************
//Created by: {NADF}Geronimo
//Date: 19.06.2011
//Version: 1.0
//Website: http://nadfserver.org
//Clan: {NADF} - North Atlantic Defence Force
//Comment: NADF FIX to reduce player threads!
//********************************************************************************
if(getCvarInt("scr_allow_flamethrower") != 0 || getCvarInt("scr_allow_flammenwerfer") != 0) self thread extreme\_ex_flamethrower::main();
//********************************************************************************
I think, the thread is died anyway, if flamethrower is not used, but better would be, never to create the player-thread.
RoundDisplay
This thread is died, when no round-display is needed. But it is created too. I prefer not to creat a thread, which is the most of the time not needed.
Bad solution i added:
//********************************************************************************
//{NADF} Round number Fix
//********************************************************************************
//Created by: {NADF}Geronimo
//Date: 19.06.2011
//Version: 1.0
//Website: http://nadfserver.org
//Clan: {NADF} - North Atlantic Defence Force
//Comment: NADF FIX to reduce player threads!
//********************************************************************************
if(!isDefined(game["roundnumber"]) || !game["roundnumber"] || game["roundnumber"] == self.pers["roundshown"] || isDefined(self.ex_roundnumber))
{
//Do nothing, Wtf is the "opposite" of that one, to save the "else"???? :(
}
else
{
self thread roundDisplay();
}
//********************************************************************************
Ok, that's all for now
Your thoughts please :oops:
Regards,
Geronimo