Raised This Month: $ Target: $400
 0% 

Database problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldTreeServers
Senior Member
Join Date: Dec 2012
Old 11-29-2013 , 11:06   Database problem
Reply With Quote #1

Hello. I try update players activity points but not updating :/ IDK how to do it but I try something

PHP Code:
public Action:CheckActivity(Handle:hTimerany:client)
{
    if(
GetConVarInt(cvar_enable))
    {
        
decl String:szSteamId[64], String:experience[1];
        new 
Float:Activity playerActicity[client] / 10.0;
        new 
Float:ActivityTotal = (Activity 1);
        
experience[0] = RoundToNearest(Float:ActivityTotal);
        
        
GetClientAuthString(clientszSteamIdsizeof(szSteamId));
        
        if (
GetTrieValue(g_hPointsszSteamIdplayerExp[client]))
        {
            
SetTrieString(g_hPointsszSteamIdexperience[0]);
            
            
decl String:szQuery[512];
            
SQL_EscapeString(hDatabaseexperience[0], experience[0], sizeof(experience));
            
SQL_EscapeString(hDatabaseszSteamIdszSteamIdsizeof(szSteamId));
            
FormatEx(szQuerysizeof(szQuery), "UPDATE ActivityPoints SET points = '%s' WHERE `steamid` LIKE '%s'"experience[0], szSteamId);
        }
        
        
PrintToChat(clientexperience);
        
playerExp[client] = playerExp[client] + experience[0];
        
        
CreateTimer(60.0CheckActivityclient);
        if(!(
playerActicity[client] <= 0) && playerActicity[client] >= 25)
        {
            
playerActicity[client] -= 25;
        }
        else
        {
            if(!(
playerActicity[client] <= 0) && playerActicity[client] >= 10)
            {
                
playerActicity[client] -= 10;
            }
            else
            {
                if(!(
playerActicity[client] <= 0) && playerActicity[client] >= 0)
                {
                    
playerActicity[client] = 0;
                }
            }
        }
    }

GoldTreeServers is offline
wyd3x
Senior Member
Join Date: Sep 2012
Old 11-29-2013 , 12:22   Re: Database problem
Reply With Quote #2

Quote:
LIKE '%s'
wt?
you need do:
WHERE 'steamid' = '%s' "), steamid
wyd3x is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-29-2013 , 12:25   Re: Database problem
Reply With Quote #3

You can't use the same buffer for input and output with SQL_EscapeString.
__________________
asherkin is offline
GoldTreeServers
Senior Member
Join Date: Dec 2012
Old 11-29-2013 , 12:55   Re: Database problem
Reply With Quote #4

Quote:
Originally Posted by asherkin View Post
You can't use the same buffer for input and output with SQL_EscapeString.
What you mean?
GoldTreeServers is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 11-29-2013 , 15:40   Re: Database problem
Reply With Quote #5

you have to create another string, empty, in order to store the output of sql_escapestring.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 11-29-2013 , 15:40   Re: Database problem
Reply With Quote #6

well, it doesn't need to be empty. i hope you got the idea.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
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 09:15.


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