v2.0.1 - fixes and reversions

This commit is contained in:
Jim Shield
2024-02-01 00:18:18 +00:00
committed by GitHub
parent f9bf5e9d17
commit a83c7d9e08
5 changed files with 54 additions and 44 deletions

View File

@@ -1,28 +1,6 @@
local skateboard, Dir, customCam, Attached, overSpeed = {}, {}, nil, false, nil local skateboard, Dir, customCam, Attached, overSpeed = {}, {}, nil, false, nil
local function createSkateboardEntity()
local entity = makeVeh("triBike3", vec4(0, 0, 0, 0))
local prop = makeProp({ prop = "v_res_skateboard", coords = vec4(0, 0, 0, 0) }, 0, 1)
while not DoesEntityExist(entity) or not DoesEntityExist(prop) do Wait(5) end
SetEntityVisible(entity, (Config.System.Debug), 0)
AttachEntityToEntity(prop, entity, GetPedBoneIndex(PlayerPedId(), 28422), 0.0, 0.0, -0.60, 0.0, 0.0, 90.0, false, true, true, true, 1, true)
SetEntityNoCollisionEntity(entity, PlayerPedId(), false)
SetEntityNoCollisionEntity(prop, PlayerPedId(), false)
SetEntityCompletelyDisableCollision(entity, true, true)
SetEntityCompletelyDisableCollision(prop, true, true)
SetVehicleDoorsLocked(entity, 10)
DisableCamCollisionForEntity(entity)
DisableCamCollisionForEntity(prop)
return entity, prop
end
local function configureSkateboard(entity) local function configureSkateboard(entity)
for k, v in pairs({ for k, v in pairs({
["fSteeringLock"] = 9.0, ["fSteeringLock"] = 9.0,
@@ -53,18 +31,6 @@ local function configureSkateboard(entity)
end end
end end
local function createBikeDriver(bike)
local entity = makePed("S_M_M_AutoShop_01", vec4(0.0, 0.0, 0.0, 0.0), 0, 1, nil, nil)
SetEntityNoCollisionEntity(entity, PlayerPedId(), false)
SetEntityCompletelyDisableCollision(entity, true, true)
SetEnableHandcuffs(entity, true)
SetEntityInvincible(entity, true)
FreezeEntityPosition(entity, true)
TaskWarpPedIntoVehicle(entity, bike, -1)
SetEntityVisible(entity, (Config.System.Debug), 0)
return entity
end
local function makeFakeSkateboard(Ped, remove) -- The animation for picking up and placing the board local function makeFakeSkateboard(Ped, remove) -- The animation for picking up and placing the board
local prop = makeProp({ prop = "v_res_skateboard", coords = vec4(0,0,0,0), false, true}) local prop = makeProp({ prop = "v_res_skateboard", coords = vec4(0,0,0,0), false, true})
if GetEntityModel(Ped) == `a_c_cat_01` then if GetEntityModel(Ped) == `a_c_cat_01` then
@@ -77,7 +43,7 @@ local function makeFakeSkateboard(Ped, remove) -- The animation for picking up a
if remove then if remove then
DeleteVehicle(skateboard.Bike) DeleteVehicle(skateboard.Bike)
destroyProp(skateboard.Skate) destroyProp(skateboard.Skate)
DeleteEntity(skateboard.Driver) DeletePed(skateboard.Driver)
end end
Wait(900) Wait(900)
destroyProp(prop) destroyProp(prop)
@@ -92,19 +58,46 @@ RegisterNetEvent("jim-skateboard:PickPlace", function() local Ped = PlayerPedId(
Attached = false Attached = false
Wait(100) Wait(100)
stopTempCam() stopTempCam()
makeFakeSkateboard(Ped, true) -- pick up animation makeFakeSkateboard(Ped, true) -- pick up animation
addItem("skateboard", 1) addItem("skateboard", 1)
skateboard = {} skateboard = {}
Dir = {} Dir = {}
else else
--Make and configure skateboard local pedCoords = GetOffsetFromEntityInWorldCoords(Ped, 0.0, 0.5, -40.5)
skateboard.Bike, skateboard.Skate = createSkateboardEntity() skateboard.Bike = makeVeh("triBike3", vec4(pedCoords.x, pedCoords.y, pedCoords.z, 0.0))
skateboard.Skate = makeProp({ prop = "v_res_skateboard", coords = vec4(pedCoords.x, pedCoords.y, pedCoords.z, 0.0) }, 1, 1)
while not DoesEntityExist(skateboard.Bike) or not DoesEntityExist(skateboard.Skate) do Wait(5) end
SetEntityNoCollisionEntity(skateboard.Bike, Ped, false)
SetEntityNoCollisionEntity(skateboard.Skate, Ped, false)
Wait(500)
configureSkateboard(skateboard.Bike) configureSkateboard(skateboard.Bike)
-- Driver properties SetEntityCompletelyDisableCollision(skateboard.Bike, true, true)
skateboard.Driver = createBikeDriver(skateboard.Bike) SetEntityCompletelyDisableCollision(skateboard.Skate, true, true)
SetEntityVisible(skateboard.Bike, Config.System.Debug, 0)
AttachEntityToEntity(skateboard.Skate, skateboard.Bike, GetPedBoneIndex(Ped, 28422), 0.0, 0.0, -0.60, 0.0, 0.0, 90.0, false, true, true, true, 1, true)
skateboard.Driver = ClonePed(Ped, true, false, true)
SetEntityCoords(skateboard.Driver, pedCoords.x, pedCoords.y, pedCoords.z, true)
while not DoesEntityExist(skateboard.Driver) do Wait(0) end
--skateboard.Driver = makePed("S_M_M_AutoShop_01", vec4(pedCoords.x, pedCoords.y, pedCoords.z, 0.0), 0, 1, nil, nil)
SetEntityNoCollisionEntity(skateboard.Driver, Ped, false)
SetEntityCompletelyDisableCollision(skateboard.Driver, true, true)
SetEnableHandcuffs(skateboard.Driver, true)
SetEntityInvincible(skateboard.Driver, true)
FreezeEntityPosition(skateboard.Driver, true)
while not IsPedSittingInAnyVehicle(skateboard.Driver) do
print("forcing ped to veh")
SetEntityVisible(skateboard.Driver, Config.System.Debug, 0)
TaskWarpPedIntoVehicle(skateboard.Driver, skateboard.Bike, -1)
Wait(10)
end
local options = { local options = {
{ action = function() TriggerEvent("jim-skateboard:GetOn", { board = skateboard.Skate }) end, { action = function() TriggerEvent("jim-skateboard:GetOn", { board = skateboard.Skate }) end,
@@ -117,6 +110,12 @@ RegisterNetEvent("jim-skateboard:PickPlace", function() local Ped = PlayerPedId(
createEntityTarget(skateboard.Bike, options, 2.5) createEntityTarget(skateboard.Bike, options, 2.5)
makeFakeSkateboard(Ped) makeFakeSkateboard(Ped)
DisableCamCollisionForEntity(skateboard.Bike)
DisableCamCollisionForEntity(skateboard.Skate)
DisableCamCollisionForEntity(skateboard.Driver)
SetVehicleDoorsLocked(skateboard.Bike, 10)
SetEntityCoords(skateboard.Bike, GetOffsetFromEntityInWorldCoords(Ped, 0.0, 0.5, 1.5)) SetEntityCoords(skateboard.Bike, GetOffsetFromEntityInWorldCoords(Ped, 0.0, 0.5, 1.5))
SetEntityHeading(skateboard.Bike, GetEntityHeading(PlayerPedId())+90) SetEntityHeading(skateboard.Bike, GetEntityHeading(PlayerPedId())+90)
removeItem("skateboard", 1) removeItem("skateboard", 1)
@@ -269,7 +268,10 @@ RegisterNetEvent("jim-skateboard:GetOn", function() local Ped = PlayerPedId()
SetEntityCollision(Ped, true, true) SetEntityCollision(Ped, true, true)
Attached = true Attached = true
updateCamLoc() updateCamLoc()
drawText(nil, {"[G] - Get Off Stakeboard", "[H] - Unlock/Lock Cam"}, "w") drawText(nil, {
(Config.System.drawText == "gta" and "~INPUT_VEH_FLY_UNDERCARRIAGE~" or "[G]").." - "..Loc[Config.Lan].getoff,
(Config.System.drawText == "gta" and "~INPUT_VEH_HEADLIGHT~" or "[H]") .." - "..Loc[Config.Lan].lockcam,
}, "w")
CreateThread(function() CreateThread(function()
while Attached do while Attached do
StopCurrentPlayingAmbientSpeech(skateboard.Driver) StopCurrentPlayingAmbientSpeech(skateboard.Driver)

View File

@@ -1,4 +1,5 @@
Config = { Config = {
Lan = "en",
System = { System = {
Debug = false, Debug = false,

View File

@@ -1,12 +1,13 @@
name "jim-skateboard" name "jim-skateboard"
author "Jimathy" author "Jimathy"
version "2.0" version "2.0.1"
description "Electric Skateboard Script By Jimathy" description "Electric Skateboard Script By Jimathy"
fx_version "cerulean" fx_version "cerulean"
game "gta5" game "gta5"
lua54 'yes' lua54 'yes'
shared_scripts { shared_scripts {
'locales/*.lua',
'config.lua', 'config.lua',
-- Required core scripts -- Required core scripts
'@ox_lib/init.lua', '@ox_lib/init.lua',

6
locales/en.lua Normal file
View File

@@ -0,0 +1,6 @@
Loc = Loc or {}
Loc["en"] = {
getoff = "Get Off Skateboard",
lockcam = "Unlock/Lock Cam",
}

View File

@@ -1 +1 @@
2.0 2.0.1