Not being able to enter passenger seats of vehicles in this gamemode?
0 replies, posted
Hello, What im trying to explain from the title is that when im playing with my friends on my server and im running this gamemode on my server and i ask him to get in my car and hes on my buddies and he clicks E to get in nothing happens like nothing at all and the passenger seats spawn because i can see them but nobody can enter them. Heres the code if it helps you anymore trying to figure this out.
[CODE]function CreatePassengerSeat ( Entity, Vect, Angles )
local SeatDatabase = list.Get("Vehicles")["Seat_Jeep"];
local OurPos = Entity:GetPos();
local OurAng = Entity:GetAngles();
local SeatPos = OurPos + (OurAng:Forward() * Vect.x) + (OurAng:Right() * Vect.y) + (OurAng:Up() * Vect.z);
local Seat = ents.Create("prop_vehicle_prisoner_pod");
Seat:SetModel(SeatDatabase.Model);
Seat:SetKeyValue("vehiclescript", "scripts/vehicles/prisoner_pod.txt");
Seat:SetAngles(OurAng + Angles);
Seat:SetPos(SeatPos);
Seat:Spawn();
Seat:Activate();
Seat:SetParent(Entity);
Seat:SetSolid(SOLID_NONE);
Seat:SetMoveType(MOVETYPE_NONE);
if SeatDatabase.Members then table.Merge(Seat, SeatDatabase.Members); end
if SeatDatabase.KeyValues then
for k, v in pairs(SeatDatabase.KeyValues) do
Seat:SetKeyValue(k, v);
end
end
Seat:GetTable().ParentCar = Entity;
Seat.VehicleName = "Jeep Seat";
Seat.VehicleTable = SeatDatabase;
Seat.ClassOverride = "prop_vehicle_prisoner_pod";
table.insert(Entity.PassengerSeats, Seat);
Seat.IsPassengerSeat = true;
if (!seatSituationMode) then
Seat:SetColor( Color(255, 255, 255, 255));
Seat:SetRenderMode(RENDERMODE_TRANSALPHA)
end
end[/CODE]
[CODE]// Passenger Seats
function GM.EnterVehicle_Seat ( Player, Vehicle )
if (Vehicle.pickupPlayer) then return true; end
if !Player or !Player:IsValid() or !Player:IsPlayer() then return; end
if !Vehicle or !Vehicle:IsValid() or !Vehicle:IsVehicle() then return; end
Player.LastLeaveVehicle = Player.LastLeaveVehicle or 0;
if Player.LastLeaveVehicle > CurTime() then return false; end
if Vehicle:IsVehicle() then
local Driver = Vehicle:GetDriver();
// make sure the driver seat is filled
if ((Driver and Driver:IsValid() and Driver:IsPlayer()) || seatSituationMode) then
if (Player:CanRideInCar(Vehicle)) then // make sure we're even wanted
for k, v in pairs(Vehicle.PassengerSeats) do
if (v and v:IsValid() and v:IsVehicle()) then // If the seat is fake, fuck off
--if (Player:Team() != TEAM_MAYOR || k > 1) then // IF we're mayor, we can only sit in the back
local owner = Vehicle:GetNetworkedEntity("owner")
local perfectCombo = owner:Team() == TEAM_POLICE && Player:Team() == TEAM_CITIZEN
if (!perfectCombo || k > 1) then // If it's a cop car, and we're an arrested citizen, then we have to be in the back
local SeatDriver = v:GetPassenger();
// are they avaialble?
if !SeatDriver or !SeatDriver:IsValid() or !SeatDriver:IsPlayer() or !SeatDriver:InVehicle() then
// make a run for it
Player:EnterVehicle(v);
break;
end
end
--end
end
end
else
Player:GetTable().LastNotBuddiesWarning = Player:GetTable().LastNotBuddiesWarning or 0;
if Player:GetTable().LastNotBuddiesWarning + 2 < CurTime() then
Player:Notify('You are not buddies with the driver.');
Player:GetTable().LastNotBuddiesWarning = CurTime();
end
end
end
end
end
hook.Add("PlayerUse", "GetInCar", GM.EnterVehicle_Seat);[/CODE]
If anyone can help me figure out why when someone trys to enter the passenger seat of the vehicles with the person on there buddies or not it wont allow them to enter the vehicle it would help me out alot thanks.
Sorry, you need to Log In to post a reply to this thread.