Commit ee0a7c74 authored by Neoony's avatar Neoony
Browse files

v0.1 WIP7 -Quickadd on not redirecting players to a full server. Still needs work

parent 10319364
Pipeline #4016 passed with stages
in 4 minutes and 1 second
......@@ -14,6 +14,7 @@ https://gaming.stackexchange.com/questions/172407/sourcebans-smx-database-failur
**Server Commands:**
**"l_query"**
*"Debug, query the servers status"*
**"l_queryx"**
*"Debug, query the servers status and print data to server console"*
......
......@@ -20,7 +20,7 @@
#include <sdkhooks>
//#include <emputils>
#define PluginVer "v0.1 WIP6"
#define PluginVer "v0.1 WIP7"
public Plugin myinfo =
{
......@@ -238,7 +238,7 @@ public void CheckPopulatedServersSinglePlayer(int Client)
// Query for servers with more or equal than l_minplayers players.
char populatedServerQuery[256];
//int minplayers = GetConVarInt(l_minplayers);
Format(populatedServerQuery, sizeof(populatedServerQuery), "SELECT addr FROM `LobbyDB`.`servers` WHERE players >= %i AND password=0 AND isenabled=1 AND name NOT LIKE '%%LOBBY%%' ORDER BY players DESC LIMIT 1;", GetConVarInt(l_minplayers));
Format(populatedServerQuery, sizeof(populatedServerQuery), "SELECT addr FROM `LobbyDB`.`servers` WHERE players >= %i AND players != maxplayers AND password=0 AND isenabled=1 AND name NOT LIKE '%%LOBBY%%' ORDER BY players DESC LIMIT 1;", GetConVarInt(l_minplayers));
SQL_TQuery(hDatabase, RedirectToPopulatedServerSinglePlayerCallback, populatedServerQuery, Client);
}
public void RedirectToPopulatedServerSinglePlayerCallback(Handle hDriver, Handle hResult, const char[] sError, int Client)
......@@ -276,7 +276,7 @@ public void CheckPopulatedServers()
// Query for servers with more or equal than l_minplayers players.
char populatedServerQuery[256];
//int minplayers = GetConVarInt(l_minplayers);
Format(populatedServerQuery, sizeof(populatedServerQuery), "SELECT addr FROM `LobbyDB`.`servers` WHERE players >= %i AND password=0 AND isenabled=1 AND name NOT LIKE '%%LOBBY%%' ORDER BY players DESC LIMIT 1;", GetConVarInt(l_minplayers));
Format(populatedServerQuery, sizeof(populatedServerQuery), "SELECT addr FROM `LobbyDB`.`servers` WHERE players >= %i AND players < maxplayers - %i AND password=0 AND isenabled=1 AND name NOT LIKE '%%LOBBY%%' ORDER BY players DESC LIMIT 1;", GetConVarInt(l_minplayers), GetClientCount());
SQL_TQuery(hDatabase, RedirectToPopulatedServerCallback, populatedServerQuery);
}
public void RedirectToPopulatedServerCallback(Handle hDriver, Handle hResult, const char[] sError, int iData)
......
......@@ -19,6 +19,7 @@
"Notes" "WIP5: Added ConVar l_forceredirect 'If this is not Zero, players will be immediately redirected to this server and will keep redirecting (IP:PORT)'"
"Notes" "WIP5: Added failsafe measures in case of connecting to DB fail, or if no servers are found while the vote wants to start'"
"Notes" "WIP6: Bugfix of l_forceredirect"
"Notes" "WIP7: Quickadd on not redirecting players to a full server. Still needs work"
}
"Files"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment