Merge from sourcemod-1.1.
This commit is contained in:
commit
f9d472847c
@ -46,6 +46,7 @@ CookieTypeHandler g_CookieTypeHandler;
|
|||||||
HandleType_t g_CookieIterator = 0;
|
HandleType_t g_CookieIterator = 0;
|
||||||
CookieIteratorHandler g_CookieIteratorHandler;
|
CookieIteratorHandler g_CookieIteratorHandler;
|
||||||
DbDriver g_DriverType;
|
DbDriver g_DriverType;
|
||||||
|
static const DatabaseInfo *storage_local = NULL;
|
||||||
|
|
||||||
bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
||||||
{
|
{
|
||||||
@ -58,6 +59,20 @@ bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
{
|
{
|
||||||
DBInfo = dbi->FindDatabaseConf("default");
|
DBInfo = dbi->FindDatabaseConf("default");
|
||||||
|
|
||||||
|
if (DBInfo == NULL ||
|
||||||
|
(strcmp(DBInfo->host, "localhost") == 0 &&
|
||||||
|
strcmp(DBInfo->database, "sourcemod") == 0 &&
|
||||||
|
strcmp(DBInfo->user, "root") == 0 &&
|
||||||
|
strcmp(DBInfo->pass, "") == 0 &&
|
||||||
|
strcmp(DBInfo->driver, "") == 0))
|
||||||
|
{
|
||||||
|
storage_local = dbi->FindDatabaseConf("storage-local");
|
||||||
|
if (DBInfo == NULL)
|
||||||
|
{
|
||||||
|
DBInfo = storage_local;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DBInfo == NULL)
|
if (DBInfo == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not find \"clientprefs\" or \"default\" database configs");
|
snprintf(error, maxlength, "Could not find \"clientprefs\" or \"default\" database configs");
|
||||||
@ -176,6 +191,14 @@ void ClientPrefs::DatabaseConnect()
|
|||||||
|
|
||||||
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
||||||
|
|
||||||
|
if (Database == NULL &&
|
||||||
|
DBInfo != storage_local &&
|
||||||
|
storage_local != NULL)
|
||||||
|
{
|
||||||
|
DBInfo = storage_local;
|
||||||
|
Database = Driver->Connect(DBInfo, true, error, sizeof(error));
|
||||||
|
}
|
||||||
|
|
||||||
if (Database == NULL)
|
if (Database == NULL)
|
||||||
{
|
{
|
||||||
g_pSM->LogError(myself, error);
|
g_pSM->LogError(myself, error);
|
||||||
|
@ -299,7 +299,7 @@ public Action:Command_Say(client, args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mapchooser && !HasEndOfMapVoteFinished())
|
if (mapchooser && EndOfMapVoteEnabled() && !HasEndOfMapVoteFinished())
|
||||||
{
|
{
|
||||||
PrintToChat(client, "[SM] %t", "Pending Vote");
|
PrintToChat(client, "[SM] %t", "Pending Vote");
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ public Action:Command_AddGroup(client, args)
|
|||||||
{
|
{
|
||||||
if (args < 2)
|
if (args < 2)
|
||||||
{
|
{
|
||||||
ReplyToCommand(client, "[SM] Usage: sm_sql_addgroup <flags> <name> [immunity]");
|
ReplyToCommand(client, "[SM] Usage: sm_sql_addgroup <name> <flags> [immunity]");
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,8 +660,8 @@ public Action:Command_AddGroup(client, args)
|
|||||||
Format(query,
|
Format(query,
|
||||||
sizeof(query),
|
sizeof(query),
|
||||||
"INSERT INTO sm_groups (flags, name, immunity_level) VALUES ('%s', '%s', '%d')",
|
"INSERT INTO sm_groups (flags, name, immunity_level) VALUES ('%s', '%s', '%d')",
|
||||||
safe_name,
|
|
||||||
safe_flags,
|
safe_flags,
|
||||||
|
safe_name,
|
||||||
immunity);
|
immunity);
|
||||||
|
|
||||||
if (!SQL_FastQuery(db, query))
|
if (!SQL_FastQuery(db, query))
|
||||||
|
Loading…
Reference in New Issue
Block a user