AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can't load more than 99999 from SQL DB. (https://forums.alliedmods.net/showthread.php?t=135940)

NiQu 08-21-2010 05:51

Can't load more than 99999 from SQL DB.
 
Hi, im making a plugin and im getting so frustrated over my problem.

Saving works fine but when i load something it seems like it can only store 5 numbers, so it can only store a maximum of 99999.

Thats my problem.

The Variable:
PHP Code:

const MAX_CLIENTS 32;
new 
g_iCash[MAX_CLIENTS 1]; 

Loading:
PHP Code:

Load(client)
{
    static 
query[128];
    
formatex(querysizeof(query) - 1"SELECT `data` FROM `cashmod` WHERE `authid` = '%s';"g_iAuthID[client]);
    
    static 
data[2];
    
data[0] = client;
    
    
SQL_ThreadQuery(g_sql_tuple"QueryLoadData"querydatasizeof(data));


PHP Code:

public QueryLoadData(failstateHandle:queryerror[], errnumdata[], sizeFloat:queuetime)
{
    if( 
failstate == TQUERY_CONNECT_FAILED
    
|| failstate == TQUERY_QUERY_FAILED )
    {
        
set_fail_state(error);
    }
    else
    {
        if( 
SQL_NumResults(query) )
        {
            static 
sqldata[512];
            
SQL_ReadResult(query0sqldatasizeof(sqldata) - 1);
            
ParseLoadData(data[0], sqldata);
        }
        else
        {
            
NewUser(data[0]);
        }
    }


PHP Code:

ParseLoadData(iPlayerdata[512])
{
    static 
num[6];
    
strbreak(datanumsizeof(num) - 1datasizeof(data) - 1);
    
    
g_iCash[iPlayer] = str_to_num(num);
    
    for( new 
iItem 0iItem g_iItemCountiItem++ )
    {
        
strbreak(datanumsizeof(num) - 1datasizeof(data) - 1);
        
g_iItemLevel[iPlayer][iItem] = clamp(str_to_num(num), 0g_iItemMaxLevel[iItem]);
    }
    
    for( new 
iWeap 0iWeap g_iWeapCountiWeap++ )
    {
        
strbreak(datanumsizeof(num) - 1datasizeof(data) - 1);
        
g_iWeapLevel[iPlayer][iWeap] = clamp(str_to_num(num), 0g_iWeapMaxLevel[iWeap]);
    }
    
    
g_loaded_data[iPlayer] = 1;


Can someone please help me fix this problem ?

lucas_7_94 08-21-2010 06:24

Re: Can't load more than 99999 from SQL DB.
 
You plugin creates the tables automatic ?

NiQu 08-21-2010 06:41

Re: Can't load more than 99999 from SQL DB.
 
Yes it does.

name varchar(32)
authid varchar(35)
data varchar(256)

lucas_7_94 08-21-2010 06:52

Re: Can't load more than 99999 from SQL DB.
 
'data' is a number ?

NiQu 08-21-2010 06:59

Re: Can't load more than 99999 from SQL DB.
 
No, it is varchar and the data gets saved like this:

10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Where the cash is the first value following by all items in my shop.

Seta00 08-21-2010 08:17

Re: Can't load more than 99999 from SQL DB.
 
Quote:

Originally Posted by lucas_7_94 (Post 1277688)
i think , i think , the problem is here

PHP Code:

static num[6];
    
strbreak(datanumsizeof(num) - 1datasizeof(data) - 1


LOL

lucas_7_94 08-21-2010 08:27

Re: Can't load more than 99999 from SQL DB.
 
Quote:

Originally Posted by Seta00 (Post 1277699)
LOL

and , if that is not the problem , what is ?

Seta00 08-21-2010 08:39

Re: Can't load more than 99999 from SQL DB.
 
Quote:

Originally Posted by lucas_7_94 (Post 1277706)
and , if that is not the problem , what is ?

That is the problem, but it's so obvious I can't imagine someone asking for help for solving that... L-O-L

lucas_7_94 08-21-2010 08:46

Re: Can't load more than 99999 from SQL DB.
 
but , i'm right , no xd lol?

DruGzOG 08-21-2010 22:18

Re: Can't load more than 99999 from SQL DB.
 
Quote:

Originally Posted by Seta00 (Post 1277714)
That is the problem, but it's so obvious I can't imagine someone asking for help for solving that... L-O-L



All times are GMT -4. The time now is 21:53.

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