mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
style: remove trailing spaces
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
Wraith ARS 2X
|
||||
Created by WolfKnight
|
||||
|
||||
For discussions, information on future updates, and more, join
|
||||
my Discord: https://discord.gg/fD4e6WD
|
||||
|
||||
|
||||
For discussions, information on future updates, and more, join
|
||||
my Discord: https://discord.gg/fD4e6WD
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-2021 WolfKnight
|
||||
@@ -33,62 +33,62 @@
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Player info variables
|
||||
----------------------------------------------------------------------------------]]--
|
||||
PLY =
|
||||
PLY =
|
||||
{
|
||||
ped = PlayerPedId(),
|
||||
veh = nil,
|
||||
inDriverSeat = false,
|
||||
inPassengerSeat = false,
|
||||
inPassengerSeat = false,
|
||||
vehClassValid = false
|
||||
}
|
||||
|
||||
function PLY:VehicleStateValid()
|
||||
return DoesEntityExist( self.veh ) and self.veh > 0 and self.vehClassValid
|
||||
end
|
||||
end
|
||||
|
||||
-- Used to check if the player is in a position where the radar should be allowed operation
|
||||
-- Used to check if the player is in a position where the radar should be allowed operation
|
||||
function PLY:IsDriver()
|
||||
return self:VehicleStateValid() and self.inDriverSeat
|
||||
end
|
||||
return self:VehicleStateValid() and self.inDriverSeat
|
||||
end
|
||||
|
||||
-- Returns if the player is in the front passenger seat of an emergency vehicle
|
||||
-- Returns if the player is in the front passenger seat of an emergency vehicle
|
||||
function PLY:IsPassenger()
|
||||
return self:VehicleStateValid() and self.inPassengerSeat
|
||||
end
|
||||
return self:VehicleStateValid() and self.inPassengerSeat
|
||||
end
|
||||
|
||||
-- Returns if the player can view the radar, ensures their vehicle state is valid and that they are a driver or
|
||||
-- Returns if the player can view the radar, ensures their vehicle state is valid and that they are a driver or
|
||||
-- a passenger (where valid)
|
||||
function PLY:CanViewRadar()
|
||||
return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerViewAllowed() )
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns if the player is allowed to control the radar from the passenger seat
|
||||
-- Returns if the player is allowed to control the radar from the passenger seat
|
||||
function PLY:CanControlRadar()
|
||||
return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerControlAllowed() )
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns the ped in the opposite seat to the player, e.g. if we're the passenger, then return the driver
|
||||
function PLY:GetOtherPed()
|
||||
if ( self:IsDriver() ) then
|
||||
if ( self:IsDriver() ) then
|
||||
return GetPedInVehicleSeat( PLY.veh, 0 )
|
||||
elseif ( self:IsPassenger() ) then
|
||||
return GetPedInVehicleSeat( PLY.veh, -1 )
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- The main purpose of this thread is to update the information about the local player, including their
|
||||
-- ped id, the vehicle id (if they're in one), whether they're in a driver seat, and if the vehicle's class
|
||||
-- is valid or not
|
||||
-- is valid or not
|
||||
Citizen.CreateThread( function()
|
||||
while ( true ) do
|
||||
while ( true ) do
|
||||
PLY.ped = PlayerPedId()
|
||||
PLY.veh = GetVehiclePedIsIn( PLY.ped, false )
|
||||
PLY.inDriverSeat = GetPedInVehicleSeat( PLY.veh, -1 ) == PLY.ped
|
||||
PLY.inPassengerSeat = GetPedInVehicleSeat( PLY.veh, 0 ) == PLY.ped
|
||||
PLY.inDriverSeat = GetPedInVehicleSeat( PLY.veh, -1 ) == PLY.ped
|
||||
PLY.inPassengerSeat = GetPedInVehicleSeat( PLY.veh, 0 ) == PLY.ped
|
||||
PLY.vehClassValid = GetVehicleClass( PLY.veh ) == 18
|
||||
|
||||
Citizen.Wait( 500 )
|
||||
end
|
||||
end
|
||||
end )
|
||||
Reference in New Issue
Block a user