Raised This Month: $51 Target: $400
 12% 

[L4D] Why is this triggering?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 10-20-2013 , 17:40   [L4D] Why is this triggering?
Reply With Quote #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(clientSDKHook_WeaponCanUseOnWeaponCanUse);
}

MySQL_Init()
{    
    
decl String:Error[192];

    
hDatabase SQLite_UseDatabase("SurvivorUpgradesReloaded"Errorsizeof(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] == && !IsFakeClient(client) && GetClientTeam(client) != 3)
    {
        
decl String:TQuery[3000], String:SteamID[64], String:UpgradeBinary[64], String:DisabledBinary[64];
        for(new 
0MAX_UPGRADESi++)
        {
            if(
== 0)
            {
                if(
iUpgrade[client][i] > 0)
                    
Format(UpgradeBinarysizeof(UpgradeBinary), "1");
                else
                    
Format(UpgradeBinarysizeof(UpgradeBinary), "0");

                if(
iUpgradeDisabled[client][i] > 0)
                    
Format(DisabledBinarysizeof(DisabledBinary), "1");
                else
                    
Format(DisabledBinarysizeof(DisabledBinary), "0");
            }
            else
            {
                if(
iUpgrade[client][i] > 0)
                    
Format(UpgradeBinarysizeof(UpgradeBinary), "%s1"UpgradeBinary);
                else
                    
Format(UpgradeBinarysizeof(UpgradeBinary), "%s0"UpgradeBinary);

                if(
iUpgradeDisabled[client][i] > 0)
                    
Format(DisabledBinarysizeof(DisabledBinary), "%s1"DisabledBinary);
                else
                    
Format(DisabledBinarysizeof(DisabledBinary), "%s0"DisabledBinary);
            }
        }
        
GetClientAuthString(clientSteamIDsizeof(SteamID));
        
Format(TQuerysizeof(TQuery), "INSERT OR REPLACE INTO accounts VALUES ('%s', %d, %d, '%s', '%s');"SteamIDiSaveFeature[client], iAnnounceText[client], UpgradeBinaryDisabledBinary);
        
SQL_FastQuery(hDatabaseTQuery);
    }
}

stock LoadData(client)
{
    if(
IsClientInGame(client) && GetClientTeam(client) != 3)
    {
        
decl String:TQuery[192], String:SteamID[64];

        
GetClientAuthString(clientSteamIDsizeof(SteamID));
        
Format(TQuerysizeof(TQuery), "SELECT * FROM accounts WHERE steamId = '%s';"SteamID);
        
SQL_TQuery(hDatabaseLoadPlayerDataTQueryclient);
    }
}

public 
LoadPlayerData(Handle:ownerHandle: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) == || 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 
0MAX_UPGRADESi++)
            {
                
iUpgrade[client][i] = 0;
            }
            
iBitsUpgrades[client] = 0;
        }
        return;
    }

    
decl String:UpgradeBinary[64], String:DisabledBinary[64];

    if(
IsClientInGame(client))
    {
        
iSaveFeature[client] = SQL_FetchInt(hndl1);
        
iAnnounceText[client] = SQL_FetchInt(hndl2);
        
SQL_FetchString(hndl3UpgradeBinarysizeof(UpgradeBinary));
        
SQL_FetchString(hndl4DisabledBinarysizeof(DisabledBinary));

        new 
len strlen(UpgradeBinary);
        for (new 
0<= leni++)
        {
            if(
UpgradeBinary[i] == '1')
            {
                
iUpgrade[client][i] = UpgradeIndex[i];
            }
        }

        
len strlen(DisabledBinary);
        for (new 
0<= leni++)
        {
            if(
DisabledBinary[i] == '1')
            {
                
iUpgradeDisabled[client][i] = 1;
            }
        }
    }
    
PrintToChatAll("Loading Client %N - %d, %d, %s"clientiSaveFeature[client], iAnnounceText[client], UpgradeBinary);

__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-20-2013 , 23:37   Re: [L4D] Why is this triggering?
Reply With Quote #2

In your loadplayerdata, you have:

PHP Code:
if(hndl == INVALID_HANDLE || SQL_GetRowCount(hndl) == || GetClientTeam(client) == 3) { /*... */ 
That means that any one of those three conditions being true will execute the code in the {}'s... are you sure hndl != INVALID_HANDLE and SQL_GetRowCount(hndl) != 0?
__________________
View my Plugins | Donate

Last edited by TnTSCS; 10-20-2013 at 23:37.
TnTSCS is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 10-21-2013 , 01:48   Re: [L4D] Why is this triggering?
Reply With Quote #3

Quote:
Originally Posted by TnTSCS View Post
In your loadplayerdata, you have:

PHP Code:
if(hndl == INVALID_HANDLE || SQL_GetRowCount(hndl) == || GetClientTeam(client) == 3) { /*... */ 
That means that any one of those three conditions being true will execute the code in the {}'s... are you sure hndl != INVALID_HANDLE and SQL_GetRowCount(hndl) != 0?
Even thought the previous 2 callbacks make sure that GetClientTeam(client) != 3? Well, okay I removed it and that fixed it...
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode