mirror of
https://github.com/accelerator74/l4dtoolz.git
synced 2024-12-22 22:47:27 +08:00
Added optional parameter maxplayers
for cmd line
This commit is contained in:
parent
f5e47d6b81
commit
c59039a46d
@ -160,7 +160,14 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
|
|||||||
if(tmp_player) {
|
if(tmp_player) {
|
||||||
get_original_signature(tmp_player, players_new, players_org);
|
get_original_signature(tmp_player, players_new, players_org);
|
||||||
write_signature(tmp_player, players_new);
|
write_signature(tmp_player, players_new);
|
||||||
engine->ServerCommand("maxplayers 31\n");
|
const char *pszCmdLineMax;
|
||||||
|
if(CommandLine()->CheckParm("-maxplayers", &pszCmdLineMax) || CommandLine()->CheckParm("+maxplayers", &pszCmdLineMax)) {
|
||||||
|
char command[32];
|
||||||
|
UTIL_Format(command, sizeof(command), "maxplayers %d\n", clamp(atoi(pszCmdLineMax), 1, 32));
|
||||||
|
engine->ServerCommand(command);
|
||||||
|
} else {
|
||||||
|
engine->ServerCommand("maxplayers 31\n");
|
||||||
|
}
|
||||||
engine->ServerExecute();
|
engine->ServerExecute();
|
||||||
write_signature(tmp_player, players_org);
|
write_signature(tmp_player, players_org);
|
||||||
free(players_org);
|
free(players_org);
|
||||||
@ -218,6 +225,23 @@ bool l4dtoolz::Unload(char *error, size_t maxlen)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
size_t len = vsnprintf(buffer, maxlength, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (len >= maxlength)
|
||||||
|
{
|
||||||
|
len = maxlength - 1;
|
||||||
|
buffer[len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
const char *l4dtoolz::GetLicense()
|
const char *l4dtoolz::GetLicense()
|
||||||
{
|
{
|
||||||
return "GPLv3";
|
return "GPLv3";
|
||||||
@ -225,7 +249,7 @@ const char *l4dtoolz::GetLicense()
|
|||||||
|
|
||||||
const char *l4dtoolz::GetVersion()
|
const char *l4dtoolz::GetVersion()
|
||||||
{
|
{
|
||||||
return "1.1.0.1";
|
return "1.1.0.2";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *l4dtoolz::GetDate()
|
const char *l4dtoolz::GetDate()
|
||||||
|
@ -38,6 +38,8 @@ public:
|
|||||||
static void* lobby_match_ptr;
|
static void* lobby_match_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
|
||||||
|
|
||||||
extern l4dtoolz g_l4dtoolz;
|
extern l4dtoolz g_l4dtoolz;
|
||||||
|
|
||||||
PLUGIN_GLOBALVARS();
|
PLUGIN_GLOBALVARS();
|
||||||
|
Loading…
Reference in New Issue
Block a user