20.01.2014, 16:12
Hello SA:MP community,
I have ran into a rather strange bug. I have a vehicle system and when you create a vehicle, you should be able to move it and it saves the location; however the vehicle moves when you use the command /permcarloc but does not save in the database. The saving function is not the problem, I've already looked into that.
Anyone who can provide a (valid) answer on how to fix this will be rewarded with a reputation point.
Best Wishes,
Nmader
Scripter
I have ran into a rather strange bug. I have a vehicle system and when you create a vehicle, you should be able to move it and it saves the location; however the vehicle moves when you use the command /permcarloc but does not save in the database. The saving function is not the problem, I've already looked into that.
pawn Код:
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:x, 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;
}
Best Wishes,
Nmader
Scripter