12.03.2015, 15:38 
	
	
	
		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.
I 've used this ^ ^ ^ ^ but it didn't work then i used this
But it also doesnt work i got no idea why it doesnt work 
[Functions]
also
and the enums
Please HELP!! it doesnt load and when it saves it saves everything except "Modelz" modelz keeps 0 but i can set it easily.
	
	
	
	
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 rows, fields;
    cache_get_data(rows, fields, MainPipeline);
    while(i<rows)
    {
        for(new field;field<fields;field++)
        {
             cache_get_row(i, field, string, MainPipeline);
            switch(field)
            {
                case 1: ATM[i][atmVW] = strval(string);
                case 2: ATM[i][atmInt] = strval(string);
                case 3: ATM[i][atmModelz] = strval(string);
                case 4: ATM[i][atmPosX] = floatstr(string);
                case 5: ATM[i][atmPosY] = floatstr(string);
                case 6: ATM[i][atmPosZ] = floatstr(string);
                case 7: ATM[i][atmAngle] = floatstr(string);
            }
        }
        RenderATM(i);
          i++;
     }
    if(i > 0) printf("[LoadATMS] %d atms rehashed/loaded.", i);
    else printf("[LoadATMS] Failed to load any atms.");
    return 1;
} 
PHP Code:
forward OnLoadATMS();
public OnLoadATMS()
{
    new i, rows, fields, tmp[128];
    cache_get_data(rows, fields, MainPipeline);
    while(i < rows)
    {
        cache_get_field_content(i, "VW", tmp, MainPipeline); ATM[i][atmVW] = strval(tmp);
        cache_get_field_content(i, "Int", tmp, MainPipeline); ATM[i][atmInt] = strval(tmp);
        cache_get_field_content(i, "Modelz", tmp, MainPipeline); ATM[i][atmModelz] = strval(tmp);
        cache_get_field_content(i, "PosX", tmp, MainPipeline); ATM[i][atmPosX] = floatstr(tmp);
        cache_get_field_content(i, "PosY", tmp, MainPipeline); ATM[i][atmPosY] = floatstr(tmp);
        cache_get_field_content(i, "PosZ", tmp, MainPipeline); ATM[i][atmPosZ] = floatstr(tmp);
        cache_get_field_content(i, "Angle", tmp, MainPipeline); ATM[i][atmAngle] = floatstr(tmp);
    }
        RenderATM(i);
          i++;
    if(i > 0) printf("[LoadATMS] %d houses rehashed/loaded.", i);
    else printf("[LoadATMS] Failed to load any houses.");
} 
[Functions]
PHP Code:
stock SaveATM(id)
{
    new string[512];
    format(string, sizeof(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(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
} 
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(2942, ATM[id][atmPosX], ATM[id][atmPosY], ATM[id][atmPosZ], 0.0, 0.0, ATM[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(string, COLOR_YELLOW, ATM[id][atmPosX], ATM[id][atmPosY], ATM[id][atmPosZ] + 0.5, 10.0, .worldid = ATM[id][atmVW], .testlos = 0, .streamdistance = 25.0);
    }
} 
PHP Code:
enum atmInfo
{
    atmVW,
    atmInt,
    atmModelz,
    Float: atmPosX,
    Float: atmPosY,
    Float: atmPosZ,
    Float: atmAngle,
    atmObjectId,
    Text3D: atmTextId
} 


