Mysql Loading Help ! [+rep]
#1

Okay i have just made a simple system from the mailbox one , i made atm system all u do[/createatm-/removeatm]

and they work fine and if anyone /awithdraw and /adeposit besides it , it work but my main proplem that its saves fine in mysql database but it doesnt load.

PHP Code:
forward OnLoadATMS();
public 
OnLoadATMS()
{
    new 
string[512], i;
    new 
rowsfields;
    
cache_get_data(rowsfieldsMainPipeline);
    while(
i<rows)
    {
        for(new 
field;field<fields;field++)
        {
             
cache_get_row(ifieldstringMainPipeline);
            switch(
field)
            {
                case 
1ATM[i][atmVW] = strval(string);
                case 
2ATM[i][atmInt] = strval(string);
                case 
3ATM[i][atmModelz] = strval(string);
                case 
4ATM[i][atmPosX] = floatstr(string);
                case 
5ATM[i][atmPosY] = floatstr(string);
                case 
6ATM[i][atmPosZ] = floatstr(string);
                case 
7ATM[i][atmAngle] = floatstr(string);
            }
        }
        
RenderATM(i);
          
i++;
     }
    if(
0printf("[LoadATMS] %d atms rehashed/loaded."i);
    else 
printf("[LoadATMS] Failed to load any atms.");
    return 
1;

I 've used this ^ ^ ^ ^ but it didn't work then i used this

PHP Code:
forward OnLoadATMS();
public 
OnLoadATMS()
{
    new 
irowsfieldstmp[128];
    
cache_get_data(rowsfieldsMainPipeline);
    while(
rows)
    {
        
cache_get_field_content(i"VW"tmpMainPipeline); ATM[i][atmVW] = strval(tmp);
        
cache_get_field_content(i"Int"tmpMainPipeline); ATM[i][atmInt] = strval(tmp);
        
cache_get_field_content(i"Modelz"tmpMainPipeline); ATM[i][atmModelz] = strval(tmp);
        
cache_get_field_content(i"PosX"tmpMainPipeline); ATM[i][atmPosX] = floatstr(tmp);
        
cache_get_field_content(i"PosY"tmpMainPipeline); ATM[i][atmPosY] = floatstr(tmp);
        
cache_get_field_content(i"PosZ"tmpMainPipeline); ATM[i][atmPosZ] = floatstr(tmp);
        
cache_get_field_content(i"Angle"tmpMainPipeline); ATM[i][atmAngle] = floatstr(tmp);
    }
        
RenderATM(i);
          
i++;
    if(
0printf("[LoadATMS] %d houses rehashed/loaded."i);
    else 
printf("[LoadATMS] Failed to load any houses.");

But it also doesnt work i got no idea why it doesnt work


[Functions]

PHP Code:
stock SaveATM(id)
{
    new 
string[512];
    
format(stringsizeof(string), "UPDATE `atms` SET \
        `VW`=%d, \
        `Int`=%d, \
        `Modelz`=%d, \
        `PosX`=%f, \
        `PosY`=%f, \
        `PosZ`=%f, \
        `Angle`=%f WHERE `id`=%d"
,
        
ATM[id][atmVW],
        
ATM[id][atmInt],
        
ATM[id][atmModelz],
        
ATM[id][atmPosX],
        
ATM[id][atmPosY],
        
ATM[id][atmPosZ],
        
ATM[id][atmAngle],
        
id+1
    
); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
    
mysql_function_query(MainPipelinestringfalse"OnQueryFinish""i"SENDDATA_THREAD);

also
PHP Code:
stock RenderATM(id)
{
    
DestroyDynamicObject(ATM[id][atmObjectId]);
    
DestroyDynamic3DTextLabel(ATM[id][atmTextId]);
    if(
ATM[id][atmPosX] != 0.0)
    {
        new 
string[128];
        
ATM[id][atmObjectId] = CreateDynamicObject(2942ATM[id][atmPosX], ATM[id][atmPosY], ATM[id][atmPosZ], 0.00.0ATM[id][atmAngle], ATM[id][atmVW], ATM[id][atmInt], .streamdistance 100.0);
        
format(string,sizeof(string),"ATM (ID: %d)\nType /awithdraw or /adeposit to transfer cash."id);
        
ATM[id][atmTextId] = CreateDynamic3DTextLabel(stringCOLOR_YELLOWATM[id][atmPosX], ATM[id][atmPosY], ATM[id][atmPosZ] + 0.510.0, .worldid ATM[id][atmVW], .testlos 0, .streamdistance 25.0);
    }

and the enums

PHP Code:
enum atmInfo
{
    
atmVW,
    
atmInt,
    
atmModelz,
    
FloatatmPosX,
    
FloatatmPosY,
    
FloatatmPosZ,
    
FloatatmAngle,
    
atmObjectId,
    
Text3DatmTextId

Please HELP!! it doesnt load and when it saves it saves everything except "Modelz" modelz keeps 0 but i can set it easily.
Reply


Messages In This Thread
Mysql Loading Help ! [+rep] - by MoemenWalid - 12.03.2015, 15:38
Re : Mysql Loading Help ! [+rep] - by Golimad - 12.03.2015, 15:44
Re: Mysql Loading Help ! [+rep] - by MoemenWalid - 12.03.2015, 15:54
Re: Mysql Loading Help ! [+rep] - by Misiur - 12.03.2015, 15:58
Respuesta: Mysql Loading Help ! [+rep] - by CuervO - 12.03.2015, 16:23
Re: Mysql Loading Help ! [+rep] - by MoemenWalid - 12.03.2015, 16:24
Re: Mysql Loading Help ! [+rep] - by Misiur - 12.03.2015, 16:28
Re: Respuesta: Mysql Loading Help ! [+rep] - by MoemenWalid - 12.03.2015, 16:43

Forum Jump:


Users browsing this thread: 2 Guest(s)