Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
|
10-20-2013
, 17:40
[L4D] Why is this triggering?
|
#1
|
Under LoadPlayerData callback is check to make sure people are not on the infected team, etc. However, the game still says that the Player is on Team 3 (infected) and processed to say "Player is not found" Even though 2 other callbacks before that check if the player is NOT on team 3. What gives, am i having another brain fart? Stupid to not see the problem?
PHP Code:
public OnClientPostAdminCheck(client)
{
if(IsClientInGame(client) && GetClientTeam(client) != 3)
LoadData(client);
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}
MySQL_Init()
{
decl String:Error[192];
hDatabase = SQLite_UseDatabase("SurvivorUpgradesReloaded", Error, sizeof(Error));
if(hDatabase == INVALID_HANDLE)
SetFailState("SQL error: %s", Error);
SQL_FastQuery(hDatabase, "CREATE TABLE IF NOT EXISTS accounts (steamid TEXT PRIMARY KEY, savemode SMALLINT, notifications SMALLINT, upgrades_binary VARCHAR(42), disabled_binary VARCHAR(42));");
}
stock SaveData(client)
{
if(iSaveFeature[client] == 1 && !IsFakeClient(client) && GetClientTeam(client) != 3)
{
decl String:TQuery[3000], String:SteamID[64], String:UpgradeBinary[64], String:DisabledBinary[64];
for(new i = 0; i < MAX_UPGRADES; i++)
{
if(i == 0)
{
if(iUpgrade[client][i] > 0)
Format(UpgradeBinary, sizeof(UpgradeBinary), "1");
else
Format(UpgradeBinary, sizeof(UpgradeBinary), "0");
if(iUpgradeDisabled[client][i] > 0)
Format(DisabledBinary, sizeof(DisabledBinary), "1");
else
Format(DisabledBinary, sizeof(DisabledBinary), "0");
}
else
{
if(iUpgrade[client][i] > 0)
Format(UpgradeBinary, sizeof(UpgradeBinary), "%s1", UpgradeBinary);
else
Format(UpgradeBinary, sizeof(UpgradeBinary), "%s0", UpgradeBinary);
if(iUpgradeDisabled[client][i] > 0)
Format(DisabledBinary, sizeof(DisabledBinary), "%s1", DisabledBinary);
else
Format(DisabledBinary, sizeof(DisabledBinary), "%s0", DisabledBinary);
}
}
GetClientAuthString(client, SteamID, sizeof(SteamID));
Format(TQuery, sizeof(TQuery), "INSERT OR REPLACE INTO accounts VALUES ('%s', %d, %d, '%s', '%s');", SteamID, iSaveFeature[client], iAnnounceText[client], UpgradeBinary, DisabledBinary);
SQL_FastQuery(hDatabase, TQuery);
}
}
stock LoadData(client)
{
if(IsClientInGame(client) && GetClientTeam(client) != 3)
{
decl String:TQuery[192], String:SteamID[64];
GetClientAuthString(client, SteamID, sizeof(SteamID));
Format(TQuery, sizeof(TQuery), "SELECT * FROM accounts WHERE steamId = '%s';", SteamID);
SQL_TQuery(hDatabase, LoadPlayerData, TQuery, client);
}
}
public LoadPlayerData(Handle:owner, Handle:hndl, const String:error[], any:client)
{
// We cannot find the player's save data, or has no save data.
if(hndl == INVALID_HANDLE || SQL_GetRowCount(hndl) == 0 || GetClientTeam(client) == 3)
{
PrintToChatAll("Player Not Found! [T:%d,N:%N", GetClientTeam(client), client);
if(!IsFakeClient(client))
{
iSaveFeature[client] = 0;
iAnnounceText[client] = 0;
for(new i = 0; i < MAX_UPGRADES; i++)
{
iUpgrade[client][i] = 0;
}
iBitsUpgrades[client] = 0;
}
return;
}
decl String:UpgradeBinary[64], String:DisabledBinary[64];
if(IsClientInGame(client))
{
iSaveFeature[client] = SQL_FetchInt(hndl, 1);
iAnnounceText[client] = SQL_FetchInt(hndl, 2);
SQL_FetchString(hndl, 3, UpgradeBinary, sizeof(UpgradeBinary));
SQL_FetchString(hndl, 4, DisabledBinary, sizeof(DisabledBinary));
new len = strlen(UpgradeBinary);
for (new i = 0; i <= len; i++)
{
if(UpgradeBinary[i] == '1')
{
iUpgrade[client][i] = UpgradeIndex[i];
}
}
len = strlen(DisabledBinary);
for (new i = 0; i <= len; i++)
{
if(DisabledBinary[i] == '1')
{
iUpgradeDisabled[client][i] = 1;
}
}
}
PrintToChatAll("Loading Client %N - %d, %d, %s", client, iSaveFeature[client], iAnnounceText[client], UpgradeBinary);
}
__________________
|
|