enum vInfo
{
	Float:LastPosX,
	Float:LastPosY,
	Float:LastPosZ,
	SpawnTimer,
	ChangePos,
};
new VehicleInfo[MAX_VEHICLES][vInfo];

public OnGameModeInit()
{
	SetTimer("UpdateVehicle", 1000, true);
}

forward UpdateVehicle();
public UpdateVehicle()
{
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
		if(GetPlayerVehicleID(i) == 0) continue;
		if(VehicleInfo[i][SpawnTimer] != 0 && gettime() >= VehicleInfo[i][SpawnTimer]) { SetVehicleToRespawnEx(i); }
		for(new p = 0; p < GetMaxPlayers(); p++)
		{
			if(!IsPlayerConnected(p)) continue;
			if(!IsPlayerInVehicle(p, i)) continue;
			new Float:Pos[3];
			GetVehiclePos(i, Pos[0], Pos[1], Pos[2]);
			VehicleInfo[i][LastPosX] = Pos[0];
			VehicleInfo[i][LastPosY] = Pos[1];
			VehicleInfo[i][LastPosZ] = Pos[2];
		}		
	}
}

stock SetVehicleToRespawnEx(vehicleid)
{
	VehicleInfo[vehicleid][ChangePos] = 1;
	SetVehicleToRespawn(vehicleid);
	VehicleInfo[vehicleid][ChangePos] = 0;
	return 1;
}

public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
{
	if(passenger_seat) return 1;
	if(VehicleInfo[vehicleid][ChangePos] == 0 && GetVehicleDistanceFromPoint(vehicleid, VehicleInfo[vehicleid][LastPosX], VehicleInfo[vehicleid][LastPosY], VehicleInfo[vehicleid][LastPosZ]) >= 70.0)
	{
		SetVehiclePos(vehicleid, VehicleInfo[vehicleid][LastPosX], VehicleInfo[vehicleid][LastPosY], VehicleInfo[vehicleid][LastPosZ]);
		Kick(playerid);
	}
	return 1;
}

stock CreateVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
{
	new ID = CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay)
	if(respawn_delay != 0) { VehicleInfo[ID][SpawnTimer] = gettime() + respawn_delay; }
	return ID;
}