| Schwabba |
10-31-2011 17:35 |
Giving bt flag before xredirect acts
Hi, i got a bad problem here, i try to add bt flag before xredirects redirects the player to an other server.
PHP Code:
public client_authorized(id) { g_authed[id] = true Load_MySql(id) }
public Load_MySql(id) { if(g_sql_ready) { if(g_SqlTuple == Empty_Handle) { set_fail_state(g_Error) }
new szSteamId[32], szTemp[512] get_user_authid(id, szSteamId, charsmax(szSteamId))
new Data[1] Data[0] = id
format(szTemp,charsmax(szTemp),"SELECT * FROM `vips` WHERE (`vips`.`steamid` = '%s')", szSteamId) SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1) } }
public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize) { if(FailState == TQUERY_CONNECT_FAILED) { log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error) } else if(FailState == TQUERY_QUERY_FAILED) { log_amx("Load Query failed. [%d] %s", Errcode, Error) } new id id = Data[0] if(SQL_NumResults(Query) < 1) { new szSteamId[32], szName[32], szQuotedName[64], szQuotedPass[64] get_user_authid(id, szSteamId, charsmax(szSteamId)) get_user_name(id, szName, 31) SQL_QuoteString(g_SqlConnection, szQuotedName, 63, szName) new szPass[MAXCHARS + 1] for(new i; i < MAXCHARS; i++) { szPass[i] = Characters[random(sizeof(Characters))] } SQL_QuoteString(g_SqlConnection, szQuotedPass, 63, szPass)
if (equal(szSteamId,"ID_PENDING")) { return PLUGIN_HANDLED } new szTemp[512]
format(szTemp,charsmax(szTemp),"INSERT INTO `vips` ( `steamid` , `name` , `pass` , `login`) VALUES ('%s','%s','%s','%s');",szSteamId, szQuotedName, szQuotedPass, szSteamId) copy(iPass[id], 63, szQuotedPass) iStars[id] = 0 iTime[id] = 0 copy(iLogin[id], 63, szSteamId) iActive[id] = 0 SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp) } else { iNummer[id] = SQL_ReadResult(Query, 0) SQL_ReadResult(Query, 3, iPass[id], 63) iStars[id] = SQL_ReadResult(Query, 4) iTime[id] = SQL_ReadResult(Query, 5) SQL_ReadResult(Query, 6, iLogin[id], 63) iActive[id] = SQL_ReadResult(Query, 7) if(iTime[id] > get_systime()) { new flags = read_flags("bt") set_user_flags(id,flags) } } g_loaded[id] = true return PLUGIN_HANDLED }
If the Server is not full, the player is vip (t flag defines vip-flag for other plugins), but he has no reserved slot, because xredirects switches him before it loads his flags. When i change the client_authorized to client_putinserver on the xredirect plugin, then it switches other players, but then i have the problem that when someone who's not vip joins the server, it does'nt switches him and there are 20/20 players.
This plugin is above the xredirect.amxx.
Someone know how to make it works?
|