MySQL R38 +++++++REP
#1

Could someone please convert these codes to MYSQL R38? PLEASE
pawn Код:
stock LoadVehicles() // You might want to make this an public so you could call it on an timer.
{
    new Query[255], id;
    format(Query, sizeof(Query), "SELECT * FROM vehicles"); // Formats the query for "mysql_query"
    mysql_query(Query); // Querys the "Query" Variable.
    mysql_store_result(); // Stores the result from Query
    while(mysql_fetch_row(Query,"|")) // Splits the row
    {
        id = LoadedInfo[Vehicles];
        sscanf(Query, "p<|>e<is[25]iiffff>", VehicleInfo[id]); // Pretty neat ehh? [ ID, OWNER, MODEL, PRICE, POS X, POS Y, POS Z, POS A ]
        new Color1 = random(126); new Color2 = random(126);
        CreateVehicle(VehicleInfo[id][Model],VehicleInfo[id][Pos][X],VehicleInfo[id][Pos][Y],VehicleInfo[id][Pos][Z],VehicleInfo[id][Pos][R],Color1,Color2, 60*10000);
        LoadedInfo[Vehicles] = LoadedInfo[Vehicles] + 1;
    }
}
&
pawn Код:
command(createveh, playerid, params[]) // Create vehicle command, not Tested.
{
    new vID, Query[200];
    if(sscanf(params, "i", vID)) return SendClientMessage(playerid, COLOR_ADMIN, "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, owner, model, price, x, y, z, a) VALUES (NULL, '%s', %d, %d, %f, %f, %f, %f);",DEFAULT_VEHICLE_OWNER,vID, DEFAULT_VEHICLE_PRICE, 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_ADMIN, Query);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)