Refactor player spawning logic in PlayerBankHeist.lua; enhance vehicle exit handling in PlayerCantUseVehicles.lua; improve invincibility checks in PlayerInvincibleAndNoCops.lua; add vehicle exit for peds in PlayerTPEverythingAway.lua; adjust darkness scaling in ScreenBackToBlack.lua; clean up snowman entities in WeatherCanadian.lua; change EffectCategory in WeatherTrueSnow.lua; add TimeSyncWithPC.lua and VehicleGodModeAllVehicles.lua scripts.
This commit is contained in:
@@ -20,11 +20,20 @@ function OnStart()
|
||||
gunManModelHash = GET_HASH_KEY(gunManModel)
|
||||
hackerModelHash = GET_HASH_KEY(hackerModel)
|
||||
|
||||
gunMan = CreatePoolPed(0, gunManModelHash, bankLoc[1], bankLoc[2], bankLoc[3]+20, 0)
|
||||
SET_PED_INTO_VEHICLE(gunMan, van, -2)
|
||||
models = {
|
||||
gunManModelHash,
|
||||
hackerModelHash
|
||||
}
|
||||
for _, model in ipairs(models) do
|
||||
REQUEST_MODEL(model)
|
||||
while not HAS_MODEL_LOADED(model) do
|
||||
WAIT(50)
|
||||
end
|
||||
|
||||
ped = CreatePoolPed(0, model, bankLoc[1], bankLoc[2], bankLoc[3]+20, 0)
|
||||
SET_PED_INTO_VEHICLE(ped, van, -2)
|
||||
end
|
||||
|
||||
hackerMan = CreatePoolPed(0, hackerModelHash, bankLoc[1], bankLoc[2], bankLoc[3]+20, 0)
|
||||
SET_PED_INTO_VEHICLE(hackerMan, van, -2)
|
||||
|
||||
|
||||
SET_PED_INTO_VEHICLE(PLAYER_PED_ID(), van, -1)
|
||||
|
||||
@@ -28,4 +28,6 @@ function OnTick()
|
||||
playerVeh = GET_VEHICLE_PED_IS_USING(playerPed)
|
||||
TASK_LEAVE_VEHICLE(playerPed, playerVeh, 16)
|
||||
end
|
||||
|
||||
WAIT(750)
|
||||
end
|
||||
|
||||
@@ -19,4 +19,9 @@ end
|
||||
function OnTick()
|
||||
SET_MAX_WANTED_LEVEL(0)
|
||||
SET_PLAYER_INVINCIBLE(GET_PLAYER_INDEX(), true)
|
||||
local player_id = PLAYER_ID()
|
||||
if GET_PLAYER_WANTED_LEVEL(player_id) > 0 then
|
||||
SET_PLAYER_WANTED_LEVEL(player_id, 0, 0)
|
||||
SET_PLAYER_WANTED_LEVEL_NOW(player_id, 0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,6 +36,10 @@ function OnStart()
|
||||
end
|
||||
for _, ped in ipairs(GetAllPeds()) do
|
||||
if ped ~= playerPed then
|
||||
if IS_PED_IN_ANY_VEHICLE(ped, false) then
|
||||
TASK_LEAVE_VEHICLE(ped, GET_VEHICLE_PED_IS_IN(ped, false), 16)
|
||||
end
|
||||
|
||||
pedPos = GET_ENTITY_COORDS(ped, true)
|
||||
distance = VDIST2(playerPos.x, playerPos.y, playerPos.z, pedPos.x, pedPos.y, pedPos.z)
|
||||
if distance < 1000000 then -- 1000 units squared
|
||||
|
||||
@@ -31,15 +31,19 @@ end
|
||||
|
||||
-- Called every game tick while the effect is active
|
||||
darkness_value = 0.0
|
||||
start = GetTickCount()
|
||||
function OnTick()
|
||||
playerPed = PLAYER_PED_ID()
|
||||
if not DOES_ENTITY_EXIST(playerPed) or IS_PLAYER_SWITCH_IN_PROGRESS() or IS_PED_DEAD_OR_DYING(playerPed,0) then return end
|
||||
DRAW_RECT(0.5, 0.5, 1.0, 1.0, 0, 0, 0, darkness_value)
|
||||
darkness_value = darkness_value + 1
|
||||
local elapsed = (GetTickCount() - start) / 1000.0
|
||||
if elapsed > 1 then
|
||||
darkness_value = darkness_value + 1
|
||||
start = GetTickCount()
|
||||
end
|
||||
if darkness_value > 255.0 then
|
||||
darkness_value = 255.0
|
||||
end
|
||||
WAIT(750)
|
||||
end
|
||||
|
||||
-- Add custom helper functions below.
|
||||
|
||||
83
Time/TimeSyncWithPC.lua
Normal file
83
Time/TimeSyncWithPC.lua
Normal file
@@ -0,0 +1,83 @@
|
||||
-- Short coherent template for a Chaos Mod effect.
|
||||
-- Edit the fields below to describe the effect and adjust timing/weighting.
|
||||
-- Full reference: https://github.com/gta-chaos-mod/ChaosModV/wiki/Lua-Scripting
|
||||
|
||||
EffectInfo = { -- ScriptInfo for mod version < 2.0
|
||||
Name = "Sync Time With PC", -- Display name of the effect
|
||||
EffectId = "time_syncwithpc", -- ScriptId for mod version < 2.0, must be unique
|
||||
--Description = "A short one-line description of what this effect does.",
|
||||
TimedType = "Custom", -- None, Normal, Short, Permanent, or "Custom"
|
||||
CustomTime = 15, -- (seconds) only if TimedType = "Custom"
|
||||
WeightMultiplier = 1, -- Relative probability of being chosen
|
||||
HideRealNameOnStart = false, -- true to hide the effect's real name when it starts
|
||||
EffectCategory = "None", -- Optional category
|
||||
EffectGroup = "", -- Optional grouping (leave empty if unused)
|
||||
IncompatibleIds = {
|
||||
-- Example: "other_effect_id", -- add EffectIds that cannot run simultaneously
|
||||
"time_freezeclock",
|
||||
}
|
||||
}
|
||||
|
||||
-- Called once when the effect starts
|
||||
function OnStart()
|
||||
print("[effect_template] OnStart: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||
-- Initialize effect state here (e.g. set timers, spawn helpers)
|
||||
end
|
||||
|
||||
-- Called once when the effect stops/ends
|
||||
function OnStop()
|
||||
print("[effect_template] OnStop: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||
-- Cleanup state here (e.g. remove entities, clear timers)
|
||||
end
|
||||
|
||||
-- Called every game tick while the effect is active
|
||||
function OnTick()
|
||||
-- Keep this lightweight. Use this for per-frame checks or gradual changes.
|
||||
local pc_time = os.date("*t")
|
||||
SET_CLOCK_TIME(pc_time.hour, pc_time.min, pc_time.sec)
|
||||
WAIT(500) -- Example: wait 500 ms between ticks, adjust as needed, also for performance
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- A compilation of frequently used lua helper functions.
|
||||
-- If downloaded externally, ensure to credit the original author.
|
||||
|
||||
-- Add custom helper functions below.
|
||||
|
||||
function IS_PLAYER_AVAILABLE()
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
if not DOES_ENTITY_EXIST(player_ped) or IS_ENTITY_DEAD(player_ped) or IS_PLAYER_SWITCH_IN_PROGRESS() then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function GET_PLAYER_PED_OFFSET(offset_x, offset_y, offset_z)
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
return GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player_ped, offset_x, offset_y, offset_z)
|
||||
end
|
||||
|
||||
function GET_PLAYER_PED_HEADING()
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
return GET_ENTITY_HEADING(player_ped)
|
||||
end
|
||||
|
||||
function RANDOM_CHOICE(p1)
|
||||
if type(p1) ~= "table" or #p1 == 0 then
|
||||
return nil
|
||||
end
|
||||
local choice = p1[math.random(#p1)]
|
||||
return choice
|
||||
end
|
||||
|
||||
|
||||
function CREATE_GHOST(ped_model, offset_x, offset_y, offset_z)
|
||||
local player_heading = GET_PLAYER_PED_HEADING()
|
||||
local ped_model_hash = GET_HASH_KEY(ped_model)
|
||||
local player_coords = GET_PLAYER_PED_OFFSET(offset_x, offset_y, offset_z)
|
||||
local ghost = CreatePoolPed(1, ped_model_hash, player_coords.x, player_coords.y, player_coords.z, player_heading)
|
||||
SET_ENTITY_ALPHA(ghost, 0, false)
|
||||
return ghost
|
||||
end
|
||||
|
||||
90
Vehs/VehicleGodModeAllVehicles.lua
Normal file
90
Vehs/VehicleGodModeAllVehicles.lua
Normal file
@@ -0,0 +1,90 @@
|
||||
-- Short coherent template for a Chaos Mod effect.
|
||||
-- Edit the fields below to describe the effect and adjust timing/weighting.
|
||||
-- Full reference: https://github.com/gta-chaos-mod/ChaosModV/wiki/Lua-Scripting
|
||||
|
||||
EffectInfo = { -- ScriptInfo for mod version < 2.0
|
||||
Name = "Godmode All Vehicles", -- Display name of the effect
|
||||
EffectId = "vehs_godmodeall", -- ScriptId for mod version < 2.0, must be unique
|
||||
--Description = "A short one-line description of what this effect does.",
|
||||
TimedType = "None", -- None, Normal, Short, Permanent, or "Custom"
|
||||
-- CustomTime = 10, -- (seconds) only if TimedType = "Custom"
|
||||
WeightMultiplier = 1, -- Relative probability of being chosen
|
||||
HideRealNameOnStart = false, -- true to hide the effect's real name when it starts
|
||||
EffectCategory = "None", -- Optional category
|
||||
EffectGroup = "_group_trafficspawner", -- Optional grouping (leave empty if unused)
|
||||
IncompatibleIds = {
|
||||
-- Example: "other_effect_id", -- add EffectIds that cannot run simultaneously
|
||||
}
|
||||
}
|
||||
|
||||
-- Called once when the effect starts
|
||||
function OnStart()
|
||||
print("[effect_template] OnStart: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||
for _, vehicle in ipairs(GetAllVehicles()) do
|
||||
SET_VEHICLE_FIXED(vehicle)
|
||||
SET_VEHICLE_PETROL_TANK_HEALTH(vehicle, 1000.0)
|
||||
SET_VEHICLE_ENGINE_HEALTH(vehicle, 1000.0)
|
||||
SET_ENTITY_INVINCIBLE(vehicle, true, true)
|
||||
SET_VEHICLE_ENGINE_CAN_DEGRADE(vehicle, false)
|
||||
SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED(vehicle, false)
|
||||
SET_VEHICLE_HAS_UNBREAKABLE_LIGHTS(vehicle, true)
|
||||
SET_VEHICLE_STRONG(vehicle, true)
|
||||
end
|
||||
-- Initialize effect state here (e.g. set timers, spawn helpers)
|
||||
end
|
||||
|
||||
-- Called once when the effect stops/ends
|
||||
function OnStop()
|
||||
print("[effect_template] OnStop: " .. ((EffectInfo and EffectInfo.Name) or "unknown"))
|
||||
-- Cleanup state here (e.g. remove entities, clear timers)
|
||||
end
|
||||
|
||||
-- Called every game tick while the effect is active
|
||||
function OnTick()
|
||||
-- Keep this lightweight. Use this for per-frame checks or gradual changes.
|
||||
WAIT(500) -- Example: wait 500 ms between ticks, adjust as needed, also for performance
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- A compilation of frequently used lua helper functions.
|
||||
-- If downloaded externally, ensure to credit the original author.
|
||||
|
||||
-- Add custom helper functions below.
|
||||
|
||||
function IS_PLAYER_AVAILABLE()
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
if not DOES_ENTITY_EXIST(player_ped) or IS_ENTITY_DEAD(player_ped) or IS_PLAYER_SWITCH_IN_PROGRESS() then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function GET_PLAYER_PED_OFFSET(offset_x, offset_y, offset_z)
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
return GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player_ped, offset_x, offset_y, offset_z)
|
||||
end
|
||||
|
||||
function GET_PLAYER_PED_HEADING()
|
||||
local player_ped = PLAYER_PED_ID()
|
||||
return GET_ENTITY_HEADING(player_ped)
|
||||
end
|
||||
|
||||
function RANDOM_CHOICE(p1)
|
||||
if type(p1) ~= "table" or #p1 == 0 then
|
||||
return nil
|
||||
end
|
||||
local choice = p1[math.random(#p1)]
|
||||
return choice
|
||||
end
|
||||
|
||||
|
||||
function CREATE_GHOST(ped_model, offset_x, offset_y, offset_z)
|
||||
local player_heading = GET_PLAYER_PED_HEADING()
|
||||
local ped_model_hash = GET_HASH_KEY(ped_model)
|
||||
local player_coords = GET_PLAYER_PED_OFFSET(offset_x, offset_y, offset_z)
|
||||
local ghost = CreatePoolPed(1, ped_model_hash, player_coords.x, player_coords.y, player_coords.z, player_heading)
|
||||
SET_ENTITY_ALPHA(ghost, 0, false)
|
||||
return ghost
|
||||
end
|
||||
|
||||
@@ -19,6 +19,11 @@ function OnStart()
|
||||
end
|
||||
|
||||
function OnStop()
|
||||
for _, object in ipairs(GetAllProps()) do
|
||||
if GET_ENTITY_MODEL(object) == snowManModelhash then
|
||||
DELETE_ENTITY(Holder(object))
|
||||
end
|
||||
end
|
||||
SetSnowState(false)
|
||||
USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(false)
|
||||
end
|
||||
@@ -39,4 +44,6 @@ function OnTick()
|
||||
end
|
||||
end
|
||||
USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(true)
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ EffectInfo = {
|
||||
EffectId = "weather_snowstorm",
|
||||
TimedType = "Normal",
|
||||
EffectGroup = "_group_weatherchange",
|
||||
EffectCategory = "Shader",
|
||||
EffectCategory = "None",
|
||||
IncompatibleIds = {
|
||||
"world_snow",
|
||||
"weather_canadian"
|
||||
|
||||
Reference in New Issue
Block a user