266 lines
10 KiB
Lua
266 lines
10 KiB
Lua
function findShit(model)
|
|
for k, v in pairs(config.dept) do
|
|
for _, car in pairs(v) do
|
|
if car == model then
|
|
return k
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
local ped = nil
|
|
local type = 1 -- 1 Freemode Male 2 Freemode Female 3 Other
|
|
local fucked = false
|
|
local oldDraw
|
|
local oldTex
|
|
-- anim@cover@weapon@reloads@rifle@pump_shotgun_mk2
|
|
Citizen.CreateThread(
|
|
function()
|
|
while true do
|
|
local playerPed = GetPlayerPed(-1)
|
|
local playerCoords = GetEntityCoords(playerPed)
|
|
local vehicle = GetClosestVehicle(playerCoords, 6.0, 0, 127)
|
|
if (DoesEntityExist(vehicle)) then
|
|
if (not IsPedInAnyVehicle(ped, true)) then
|
|
local trunk = GetEntityBoneIndexByName(vehicle, "boot")
|
|
local seat = GetEntityBoneIndexByName(vehicle, "seat_dside_f")
|
|
local seat2 = GetEntityBoneIndexByName(vehicle, "seat_pside_f")
|
|
if trunk ~= -1 then
|
|
local coords = GetWorldPositionOfEntityBone(vehicle, trunk)
|
|
if (#(GetEntityCoords(ped) - coords)) <= 2.0 then
|
|
if (GetVehicleClass(vehicle) == 18) then
|
|
if GetVehicleDoorAngleRatio(vehicle, 5) < 0.1 then
|
|
DrawText3D(coords, "[~c~H~s~] Open")
|
|
if IsControlJustReleased(0, 74) then
|
|
SetCarBootOpen(vehicle)
|
|
end
|
|
else
|
|
DrawText3D(
|
|
coords,
|
|
"[~c~H~s~]Close\n[~c~4~s~]Vest\n[~c~5~s~]Less Lethal \n[~c~6~s~]Fire Ext\n[~c~7~s~]Flare"
|
|
)
|
|
if IsControlJustReleased(0, 74) then
|
|
SetVehicleDoorShut(vehicle, 5)
|
|
end
|
|
if IsControlJustReleased(0, 110) then
|
|
LessLethal()
|
|
end
|
|
if IsControlJustReleased(0, 108) then
|
|
TrafficShit(vehicle)
|
|
end
|
|
if IsControlJustReleased(0, 109) then
|
|
fire()
|
|
end
|
|
if IsControlJustReleased(0, 117) then
|
|
flare()
|
|
end
|
|
end
|
|
else
|
|
if GetVehicleDoorAngleRatio(vehicle, 5) < 0.1 then
|
|
DrawText3D(coords, "[~c~H~s~] Open")
|
|
if IsControlJustReleased(0, 74) then
|
|
SetCarBootOpen(vehicle)
|
|
end
|
|
else
|
|
DrawText3D(coords, "[~c~H~s~] Close")
|
|
if IsControlJustReleased(0, 74) then
|
|
SetVehicleDoorShut(vehicle, 5)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if seat ~= -1 then
|
|
local coords = GetWorldPositionOfEntityBone(vehicle, seat)
|
|
local pedcoords = GetEntityCoords(ped)
|
|
if (#(pedcoords - coords)) <= 1.0 then
|
|
if (GetVehicleClass(vehicle) == 18) then
|
|
if (GetVehicleDoorAngleRatio(vehicle, 0) > 0.1) then
|
|
if (HasPedGotWeapon(ped, config.lethal, false)) then
|
|
DrawText3D(coords, "[~c~NUM 6~s~] Rack Rifle")
|
|
else
|
|
DrawText3D(coords, "[~c~NUM 6~s~] Unrack Rifle")
|
|
end
|
|
if IsControlJustReleased(0, 107) then
|
|
Lethal()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if seat2 ~= -1 then
|
|
local coords = GetWorldPositionOfEntityBone(vehicle, seat2)
|
|
local pedcoords = GetEntityCoords(ped)
|
|
if (#(pedcoords - coords)) <= 1.0 then
|
|
if (GetVehicleClass(vehicle) == 18) then
|
|
if (GetVehicleDoorAngleRatio(vehicle, 1) > 0.1) then
|
|
if (HasPedGotWeapon(ped, config.submg, false)) then
|
|
DrawText3D(coords, "[~c~NUM 6~s~] Rack MP5")
|
|
else
|
|
DrawText3D(coords, "[~c~NUM 6~s~] Unrack MP5")
|
|
end
|
|
if IsControlJustReleased(0, 107) then
|
|
Lethal2()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
Wait(0)
|
|
end
|
|
end
|
|
)
|
|
|
|
Citizen.CreateThread(
|
|
function()
|
|
while true do
|
|
ped = PlayerPedId()
|
|
local pedHash = GetEntityModel(ped)
|
|
|
|
if (pedHash == GetHashKey("mp_m_freemode_01")) then
|
|
type = 1
|
|
elseif (pedHash == GetHashKey("mp_f_freemode_01")) then
|
|
type = 2
|
|
else
|
|
type = 3
|
|
end
|
|
Citizen.Wait(5000)
|
|
end
|
|
end
|
|
)
|
|
|
|
function loadAnimDict(dict)
|
|
RequestAnimDict(dict)
|
|
while not HasAnimDictLoaded(dict) do
|
|
Citizen.Wait(1)
|
|
end
|
|
end
|
|
|
|
function DrawText3D(coords, text)
|
|
local onScreen, _x, _y = World3dToScreen2d(coords.x, coords.y, coords.z)
|
|
local pX, pY, pZ = table.unpack(GetGameplayCamCoords())
|
|
|
|
SetTextScale(0.4, 0.4)
|
|
SetTextFont(4)
|
|
SetTextProportional(1)
|
|
SetTextEntry("STRING")
|
|
SetTextCentre(1)
|
|
SetTextColour(255, 255, 255, 255)
|
|
SetTextOutline()
|
|
|
|
AddTextComponentString(text)
|
|
DrawText(_x, _y)
|
|
end
|
|
|
|
function TrafficShit(veh)
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if fucked then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(500)
|
|
ClearPedTasks(ped)
|
|
SetPedComponentVariation(ped, 9, oldDraw, oldTex, 0)
|
|
fucked = false
|
|
else
|
|
oldDraw = GetPedDrawableVariation(ped, 9)
|
|
oldTex = GetPedTextureVariation(ped, 9)
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(500)
|
|
ClearPedTasks(ped)
|
|
local dept = findShit(GetEntityModel(veh))
|
|
if type == 1 then
|
|
SetPedComponentVariation(ped, 9, tonumber(config.ped[dept].male.draw), tonumber(config.ped[dept].male.tex), 0)
|
|
elseif type == 2 then
|
|
SetPedComponentVariation(ped, 9, tonumber(config.ped[dept].female.draw), tonumber(config.ped[dept].female.tex), 0)
|
|
end
|
|
fucked = true
|
|
end
|
|
end
|
|
|
|
function LessLethal()
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if (HasPedGotWeapon(ped, config.lesslethal, false)) then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(500)
|
|
ClearPedTasks(ped)
|
|
RemoveWeaponFromPed(ped, config.lesslethal)
|
|
else
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(500)
|
|
ClearPedTasks(ped)
|
|
GiveWeaponToPed(ped, config.lesslethal, 20, false, true)
|
|
end
|
|
end
|
|
|
|
function Lethal()
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if (HasPedGotWeapon(ped, config.lethal, false)) then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
RemoveWeaponFromPed(ped, config.lethal)
|
|
else
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
GiveWeaponToPed(ped, config.lethal, 20, false, true)
|
|
end
|
|
end
|
|
|
|
function Lethal2()
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if (HasPedGotWeapon(ped, config.submg, false)) then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
RemoveWeaponFromPed(ped, config.submg)
|
|
else
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
GiveWeaponToPed(ped, config.submg, 20, false, true)
|
|
end
|
|
end
|
|
|
|
function fire()
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if (HasPedGotWeapon(ped, config.fire, false)) then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
RemoveWeaponFromPed(ped, config.fire)
|
|
else
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
GiveWeaponToPed(ped, config.fire, 9999, false, true)
|
|
end
|
|
end
|
|
|
|
function flare()
|
|
local dict = "mini@repair"
|
|
local anim = "fixing_a_player"
|
|
loadAnimDict(dict)
|
|
if (HasPedGotWeapon(ped, config.flare, false)) then
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
RemoveWeaponFromPed(ped, config.flare)
|
|
else
|
|
TaskPlayAnim(ped, dict, anim, 8.0, 8.0, -1, 0, 0, false, false, false)
|
|
Citizen.Wait(350)
|
|
ClearPedTasks(ped)
|
|
GiveWeaponToPed(ped, config.flare, 20, false, true)
|
|
end
|
|
end |