diff --git a/Player/PlayerBankHeist.lua b/Player/PlayerBankHeist.lua index f290e24..67abdf9 100644 --- a/Player/PlayerBankHeist.lua +++ b/Player/PlayerBankHeist.lua @@ -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) - - hackerMan = CreatePoolPed(0, hackerModelHash, bankLoc[1], bankLoc[2], bankLoc[3]+20, 0) - SET_PED_INTO_VEHICLE(hackerMan, 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 + SET_PED_INTO_VEHICLE(PLAYER_PED_ID(), van, -1) diff --git a/Player/PlayerCantUseVehicles.lua b/Player/PlayerCantUseVehicles.lua index cffec8b..df3fe51 100644 --- a/Player/PlayerCantUseVehicles.lua +++ b/Player/PlayerCantUseVehicles.lua @@ -28,4 +28,6 @@ function OnTick() playerVeh = GET_VEHICLE_PED_IS_USING(playerPed) TASK_LEAVE_VEHICLE(playerPed, playerVeh, 16) end + + WAIT(750) end diff --git a/Player/PlayerInvincibleAndNoCops.lua b/Player/PlayerInvincibleAndNoCops.lua index 3f94ca1..cb5e000 100644 --- a/Player/PlayerInvincibleAndNoCops.lua +++ b/Player/PlayerInvincibleAndNoCops.lua @@ -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 diff --git a/Player/PlayerTPEverythingAway.lua b/Player/PlayerTPEverythingAway.lua index dcf5566..cd55e82 100644 --- a/Player/PlayerTPEverythingAway.lua +++ b/Player/PlayerTPEverythingAway.lua @@ -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 diff --git a/Screen/ScreenBackToBlack.lua b/Screen/ScreenBackToBlack.lua index dad713b..e85a56c 100644 --- a/Screen/ScreenBackToBlack.lua +++ b/Screen/ScreenBackToBlack.lua @@ -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. diff --git a/Time/TimeSyncWithPC.lua b/Time/TimeSyncWithPC.lua new file mode 100644 index 0000000..d318b38 --- /dev/null +++ b/Time/TimeSyncWithPC.lua @@ -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 + diff --git a/Vehs/VehicleGodModeAllVehicles.lua b/Vehs/VehicleGodModeAllVehicles.lua new file mode 100644 index 0000000..a12b522 --- /dev/null +++ b/Vehs/VehicleGodModeAllVehicles.lua @@ -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 + diff --git a/Weather/WeatherCanadian.lua b/Weather/WeatherCanadian.lua index 8a43999..5f76dd2 100644 --- a/Weather/WeatherCanadian.lua +++ b/Weather/WeatherCanadian.lua @@ -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 diff --git a/Weather/WeatherTrueSnow.lua b/Weather/WeatherTrueSnow.lua index e241ecb..3b16fff 100644 --- a/Weather/WeatherTrueSnow.lua +++ b/Weather/WeatherTrueSnow.lua @@ -3,7 +3,7 @@ EffectInfo = { EffectId = "weather_snowstorm", TimedType = "Normal", EffectGroup = "_group_weatherchange", - EffectCategory = "Shader", + EffectCategory = "None", IncompatibleIds = { "world_snow", "weather_canadian"