Vehicle saving problem
#1

Alright. I'm using SQLite and I have a huge problem with the vehicles.

I'm using /permcar to create a permanent vehicle in game. It's dynamic system. They are saving in the datebase. When I do /permcarloc ( to change the location of the vehicle ) it doesnt work. It's changing the location but after a restart of the server via /gmx or /restart, the car is standing on the location which I set with /permcar. It doesn't save the location of /permcarloc. Is there way to help me please?
Reply
#2

Bump, please help me.
Reply
#3

Post the code for /permcarloc as maybe its not saving the vehicle position correctly.

Another thing that can help, is after you have formatted the sql query, print out that query with print(); and try using that printed query directly in phpmyadmin for example as that may show some more errors.
Reply
#4

/permcarloc command
Quote:

dcmd_permcarloc(playerid, params[])
{
new vehicleid;
if(PlayerInfo[playerid][pAdmin] < 1337) return ErrorMessage(playerid, "You cannot use this command.");
if(sscanf(params, "d", vehicleid)) return SyntaxMessage(playerid, "/permcarloc [vehicle id]");
if(PermanentVehicleStatistics[vehicleid][IsPermCar])
{
new Float, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
SetVehiclePos(vehicleid, x, y, z);
PutPlayerInVehicle(playerid, vehicleid, 0);
SetVehicleZAngle(vehicleid, a);
SetPlayerPosEx(playerid, x, y, z);

// reset the vehicle
new
vehicle,
sql = PermanentVehicleStatistics[vehicleid][PermCarSQL],
color1 = PermanentVehicleStatistics[vehicleid][PermCarColors][1],
color2 = PermanentVehicleStatistics[vehicleid][PermCarColors][2],
faction = PermanentVehicleStatistics[vehicleid][PermCarFaction],
family = PermanentVehicleStatistics[vehicleid][PermCarFamily],
vip = PermanentVehicleStatistics[vehicleid][PermCarVIP],
model = PermanentVehicleStatistics[vehicleid][PermCarModel],
interior = PermanentVehicleStatistics[vehicleid][PermCarInt],
world = PermanentVehicleStatistics[vehicleid][PermCarVW];

DestroyVehicleEx(vehicleid);
PermanentVehicleStatistics[vehicleid][IsPermCar] = 0;
PermanentVehicleStatistics[vehicleid][PermCarModel] = 0;
PermanentVehicleStatistics[vehicleid][PermCarFamily] = 0;
PermanentVehicleStatistics[vehicleid][PermCarX] = 0.0;
PermanentVehicleStatistics[vehicleid][PermCarY] = 0.0;
PermanentVehicleStatistics[vehicleid][PermCarZ] = 0.0;
PermanentVehicleStatistics[vehicleid][PermCarRot] = 0.0;
PermanentVehicleStatistics[vehicleid][PermCarColors][1] = 0;
PermanentVehicleStatistics[vehicleid][PermCarColors][2] = 0;
PermanentVehicleStatistics[vehicleid][PermCarVIP] = 0;
PermanentVehicleStatistics[vehicleid][PermCarFaction] = 0;
PermanentVehicleStatistics[vehicleid][PermCarSQL] = 0;

vehicle = AddStaticVehicleEx(model, x, y, z, a, color1, color2, 1800);
PermanentVehicleStatistics[vehicle][IsPermCar] = 1;
PermanentVehicleStatistics[vehicle][PermCarID] = vehicleid;
PermanentVehicleStatistics[vehicle][PermCarX] = x;
PermanentVehicleStatistics[vehicle][PermCarY] = y;
PermanentVehicleStatistics[vehicle][PermCarZ] = z;
PermanentVehicleStatistics[vehicle][PermCarRot] = a;
PermanentVehicleStatistics[vehicle][PermCarColors][1] = color1;
PermanentVehicleStatistics[vehicle][PermCarColors][2] = color2;
PermanentVehicleStatistics[vehicle][PermCarFaction] = faction;
PermanentVehicleStatistics[vehicle][PermCarFamily] = family;
PermanentVehicleStatistics[vehicle][PermCarModel] = model;
PermanentVehicleStatistics[vehicle][PermCarVIP] = vip;
PermanentVehicleStatistics[vehicle][PermCarInt] = interior;
PermanentVehicleStatistics[vehicle][PermCarVW] = world;
PermanentVehicleStatistics[vehicle][PermCarSQL] = sql;

LinkVehicleToInterior(vehicle, interior);
SetVehicleVirtualWorld(vehicle, world);

SetPlayerPos(playerid, x, y, z + 2);
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreezeMeNow", 800, false, "i", playerid);
SavePermanentVehicle(vehicle);
return 1;
}
else { SendClientMessage(playerid, GREY, "This vehicle is not a permanent vehicle."); }
return 1;
}

Reply
#5

Fixed, Lock it!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)