Car load won't work
#2

Not tested
try.:
pawn Код:
#include <a_samp>
#include <a_mysql>
#include <sscanf2>

enum
    Cars_Enum
{
    Id,        
    Owner[24],
    Model,
    Float:X,
    Float:Y,
    Float:Z,
    Float:Angle,
    HP,
    Fuel,
    Color1,
    Color2,
    Lock,
    tune0,
    tune1,
    tune2,
    tune3,
    tune4,
    tune5,
    tune6,
    tune7,
    tune8,
    tune9,
    tune10,
    tune11,
    tune12
};

new
    vInfo[MAX_VEHICLES][Cars_Enum];

stock
    LoadVehicles_Mysql()
{
    if(!mysql_ping()) return 0;
    new
        FetchLine[512],
        index = 0;
    mysql_query("SELECT * FROM `vehicles`"); // select from all vehicles database
    mysql_store_result();                   // store result
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(FetchLine))
        {
            sscanf(FetchLine, "e<p<|>is[25]dffffdddddddddddddddddd>", vInfo[index]);
            CreateVehicle(  vInfo[index][Model],
                            vInfo[index][X],
                            vInfo[index][Y],
                            vInfo[index][Z],
                            vInfo[index][Angle],
                            vInfo[index][Color1],
                            vInfo[index][Color2],
                            60000
                        );
            index++;
            if(index == MAX_VEHICLES - 1) break;
        }
    } print("ERROR 0 row's sql database");
    mysql_free_result(); // free result
    return 1;
}
   
public
//  OnFilterScriptInit()
// or
    OnGameModeInit()
{
    ConnectMySQL();    
    LoadVehicles_Mysql();
    return 1;
}
Reply


Messages In This Thread
Car load won't work - by ajwar - 28.10.2010, 16:34
Re: Car load won't work - by smeti - 28.10.2010, 20:37

Forum Jump:


Users browsing this thread: 2 Guest(s)