#1

How would i get vehicle information from a file using y_ini?? This is how i did with mysql, how to do with y_ini?


Loading:

pawn Код:
stock LoadVehicles()
{
    for(new id; id < SCRIPT_CARS; id++)
    {
        format(Query, sizeof(Query), "SELECT * FROM vehicles WHERE id= %d", id);
        mysql_query(Query);
        mysql_store_result();
        if(mysql_num_rows())
        if(mysql_fetch_row(Query,"|"))
        {
            sscanf(Query, "p<|>e<iiffff>", Vehicles[id]);
            new Color1 = random(126); new Color2 = random(126);
            CreateVehicle(Vehicles[id][Model],Vehicles[id][POS][0],Vehicles[id][POS][1],Vehicles[id][POS][2],Vehicles[id][POS][3],Color1,Color2, 60*10000);
        }
    }
}



The command to make cars that i used with mysql:

pawn Код:
command(createveh, playerid, params[]) // Create vehicle command, not Tested.
{
    new vID, Query[200];
    if(sscanf(params, "i", vID)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /createveh [ ModelID ]");
    new Float:pPOS[4];
    GetPlayerPos(playerid, pPOS[0], pPOS[1], pPOS[2]);
    GetPlayerFacingAngle(playerid , pPOS[3]);
    format(Query, sizeof(Query), "INSERT INTO vehicles (id, model, x, y, z, a) VALUES (NULL, %d, %f, %f, %f, %f);",vID, pPOS[0], pPOS[1], pPOS[2], pPOS[3]);
    mysql_query(Query);
    format(Query, sizeof(Query), "Created an %d at x: %f y: %f z: %f a: %f);",vID,pPOS[0], pPOS[1], pPOS[2], pPOS[3]);
    SendClientMessage(playerid, COLOR_ORANGE, Query);
    new Color1 = random(126); new Color2 = random(126);
    CreateVehicle(vID, pPOS[0], pPOS[1], pPOS[2], pPOS[3], Color1, Color2, 60*10000);
    return 1;
}

I would love it if someone could show me how to do the loading at least, as the command i could figure out with the loading ^ Thanks in advance.


Yes I looked for other topics, and none i found had this. If you find a veh system with y_ini, feel free to just post a link.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)