#1

Hello, I'm new at MySQL and I was happy that someone would explain why the following code does not work
pawn Код:
CMD:addcar(playerid, params[])
{
    if(AdminLevel(playerid) < MAX_ADMIN_LEVEL) return 0;
    if(!AdminLogged(playerid)) return SendClientMessage(playerid, Red, "( /ALogin [password] )  !עלייך להתחבר למערכת");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, ".עלייך להיות בתוך רכב");
    new veh = GetPlayerVehicleID(playerid),
        query[256],
        Float:Pos[4],
        Color[2];
    GetVehiclePos(veh, Pos[0], Pos[1], Pos[2]);
    GetVehicleZAngle(veh, Pos[3]);
    GetVehicleColor(veh, Color[0], Color[1]);
    strcpy(Vehicle[veh][Owners], "None", 5);
    Vehicle[veh][HaveOwners] = 0;
    Vehicle[veh][VehicleType] = PublicCar;
    Vehicle[veh][VehiclePrice] = RandomEx2(100000, 6000000, 100000);
    strcpy(Vehicle[veh][vName], GetVehicleName(veh), 32);
    Vehicle[veh][PayTax] = 15;
    mysql_format(SQL, query, sizeof query, "INSERT INTO `vehicles` VALUES (%d, %f, %f, %f, %f, %d, %d, None, 0, 0, %d, %e, 15)", GetVehicleModel(veh), Pos[0], Pos[1], Pos[2], Pos[3], Color[0], Color[1], Vehicle[veh][VehiclePrice], Vehicle[veh][vName]);
    return mysql_tquery(SQL, query, "OnVehicleSaved", "d", playerid);
}

Public:OnVehicleSaved(playerid)
{
    Server[Max_Vehicles]++;
    return SendClientMessage(playerid, Aqua, "!הרכב נוסף לשרת");
}
Reply
#2

That will insert information about car you're sitting in into your database.
In other words creates a new vehicle to use in your database.
Reply
#3

Quote:
Originally Posted by MicroD
Посмотреть сообщение
That will insert information about car you're sitting in into your database.
In other words creates a new vehicle to use in your database.
I know what the code does
But the data do not inserted to the database
That's what does not work:
pawn Код:
mysql_format(SQL, query, sizeof query, "INSERT INTO `vehicles` VALUES (%d, %f, %f, %f, %f, %d, %d, None, 0, 0, %d, %e, 15)", GetVehicleModel(veh), Pos[0], Pos[1], Pos[2], Pos[3], Color[0], Color[1], Vehicle[veh][VehiclePrice], Vehicle[veh][vName]);
return mysql_tquery(SQL, query, "OnVehicleSaved", "d", playerid);
---
Problem solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)