Vehicle saving problem
#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


Messages In This Thread
Vehicle saving problem - by benjaminjones - 19.01.2014, 23:28
Re: Vehicle saving problem - by benjaminjones - 20.01.2014, 16:37
Re: Vehicle saving problem - by Grimrandomer - 21.01.2014, 13:32
Re: Vehicle saving problem - by benjaminjones - 21.01.2014, 18:38
Re: Vehicle saving problem - by benjaminjones - 24.01.2014, 23:45

Forum Jump:


Users browsing this thread: 1 Guest(s)