Command not updating to MySQL
#1

This is my command;
pawn Код:
CMD:saveveh(playerid, params[])
{
    if(playerVariables[playerid][pGamemaster] >= 3)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You have to be in a vehicle to use this command");
        {
            new szQuery[300], Float:vehx, Float:vehy, Float:vehz, currentveh, currentmodel;
            currentveh = GetPlayerVehicleID(playerid);
            currentmodel = GetVehicleModel(currentmodel);
            GetVehiclePos(currentveh, vehx, vehy, vehz);
            format(szQuery, sizeof(szQuery), "UPDATE vehicles INSERT vModel = '%d' AND PosX = '%d' AND PosY = '%d' AND PosZ = '%d' AND Color1 = '%d' AND Color2 = '%d' WHERE ID = '%d'", serverVehicle[currentmodel][vModel], serverVehicle[currentveh][PosZ], serverVehicle[currentveh][PosY], serverVehicle[currentveh][PosZ], serverVehicle[currentveh][Color1], serverVehicle[currentveh][Color2], serverVehicle[currentveh][vID]);
            mysql_query(szQuery);
            SendClientMessage(playerid, COLOR_YELLOW, "|- Vehicle Saved and updated to MySQL! -|");
        }// We don't have the rotation ¬_¬ <- remove rot :D You removed it? nah
    }
    return 1;
}
For some reason it's not updating MySQL.
This is under GameModeInit also;
pawn Код:
new szQuery[300];
    format(szQuery, sizeof(szQuery), "SELECT * FROM vehicles WHERE vID = '%d'", serverVehicle[veh][vID]);
    mysql_query(szQuery);
If you need, here is my serverVehicle enum;
Код:
enum veh
{
	vID,
	vModel,
	PosX,
	PosY,
	PosZ,
	PosR,
	Color1,
	Color2
}
new	serverVehicle[MAX_VEHICLES][veh];
Reply
#2

Try this
pawn Код:
UPDATE vehicles SET vModel = '%d', PosX = '%d', PosY = '%d', PosZ = '%d', Color1 = '%d', Color2 = '%d' WHERE ID = '%d'
So, instead of INSERT it's SET and instead of AND it's ,
Reply
#3

Still doesn't update to MySQL ;/
Reply
#4

Anyone?
Reply
#5

Coordinates are floats, so it's supposed to be %f not %d. Try this:

pawn Код:
UPDATE vehicles SET vModel = '%d', PosX = '%f', PosY = '%f', PosZ = '%f', Color1 = '%d', Color2 = '%d' WHERE ID = '%d'
And:

pawn Код:
enum veh
{
    vID,
    vModel,
    Float:PosX,
    Float:PosY,
    Float:PosZ,
    Float:PosR,
    Color1,
    Color2
}
Reply
#6

Still doesn't update to MySQL.
Reply
#7

What does it say in MYSQL_LOG?
Reply
#8

Nothing, I don't get one.
Reply
#9

On gamemodeinit add:
pawn Код:
mysql_debug(1);
Go ingame, use the command and come and post the MYSQL_LOG here. It's in your server folder.
Reply
#10

Nothing comes up in the log.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)