Command not updating to MySQL -
Elysian` - 09.07.2012
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];
Re: Command not updating to MySQL -
Dodo9655 - 09.07.2012
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 ,
Re: Command not updating to MySQL -
Elysian` - 16.07.2012
Still doesn't update to MySQL ;/
Re: Command not updating to MySQL -
Elysian` - 16.07.2012
Anyone?
Re: Command not updating to MySQL -
Dan. - 16.07.2012
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
}
Re: Command not updating to MySQL -
Elysian` - 16.07.2012
Still doesn't update to MySQL.
Re: Command not updating to MySQL -
Dan. - 16.07.2012
What does it say in MYSQL_LOG?
Re: Command not updating to MySQL -
Elysian` - 18.07.2012
Nothing, I don't get one.
Re: Command not updating to MySQL -
Dan. - 18.07.2012
On gamemodeinit add:
Go ingame, use the command and come and post the MYSQL_LOG here. It's in your server folder.
Re: Command not updating to MySQL -
Elysian` - 18.07.2012
Nothing comes up in the log.