News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Flame mod template  (Read 94 times)

0 Members and 1 Guest are viewing this topic.

Offline Ming

  • Full Member
  • ***
  • Posts: 146
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Flame mod template
« on: September 01, 2022, 01:15:37 AM »
Code: [Select]
-- By TianDiZhuZai
-- QQ:2806336657
function main()
  repeat
    Wait(0)
  until SystemIsReady() and not AreaIsLoading()
  Wait(500)
 
  LoadAnimationGroup("Authority")
  LoadAnimationGroup("Bike")
  LoadAnimationGroup("V_Bike")
  LoadAnimationGroup("Boxing")
  LoadAnimationGroup("B_Striker")
  LoadAnimationGroup("CV_Female")
  LoadAnimationGroup("CV_Male")
  LoadAnimationGroup("DO_Edgar")
  LoadAnimationGroup("DO_Grap")
  LoadAnimationGroup("DO_StrikeCombo")
  LoadAnimationGroup("DO_Striker")
  LoadAnimationGroup("Earnest")
  LoadAnimationGroup("F_Adult")
  LoadAnimationGroup("F_BULLY")
  LoadAnimationGroup("F_Crazy")
  LoadAnimationGroup("F_Douts")
  LoadAnimationGroup("F_Girls")
  LoadAnimationGroup("F_Greas")
  LoadAnimationGroup("F_Jocks")
  LoadAnimationGroup("F_Nerds")
  LoadAnimationGroup("F_OldPeds")
  LoadAnimationGroup("F_Pref")
  LoadAnimationGroup("F_Preps")
  LoadAnimationGroup("G_Grappler")
  LoadAnimationGroup("G_Johnny")
  LoadAnimationGroup("G_Striker")
  LoadAnimationGroup("Grap")
  LoadAnimationGroup("J_Damon")
  LoadAnimationGroup("J_Grappler")
  LoadAnimationGroup("J_Melee")
  LoadAnimationGroup("J_Ranged")
  LoadAnimationGroup("J_Striker")
  LoadAnimationGroup("LE_Orderly")
  LoadAnimationGroup("Nemesis")
  LoadAnimationGroup("NPC_AggroTaunt")
  LoadAnimationGroup("NPC_Mascot")
  LoadAnimationGroup("N_Ranged")
  LoadAnimationGroup("N_Striker")
  LoadAnimationGroup("N_Striker_A")
  LoadAnimationGroup("N_Striker_B")
  LoadAnimationGroup("P_Grappler")
  LoadAnimationGroup("P_Striker")
  LoadAnimationGroup("PunchBag")
  LoadAnimationGroup("Qped")
  LoadAnimationGroup("Rat_Ped")
  LoadAnimationGroup("Russell")
  LoadAnimationGroup("Russell_Pbomb")
  LoadAnimationGroup("Straf_Dout")
  LoadAnimationGroup("Straf_Fat")
  LoadAnimationGroup("Straf_Female")
  LoadAnimationGroup("Straf_Male")
  LoadAnimationGroup("Straf_Nerd")
  LoadAnimationGroup("Straf_Prep")
  LoadAnimationGroup("Straf_Savage")
  LoadAnimationGroup("Straf_Wrest")
  LoadAnimationGroup("TE_Female")
  LoadAnimationGroup("Dodgeball")
  LoadAnimationGroup("Dodgeball2")
 
  CreateThread("TianDiZhuZai")
  CreateThread("CrtDltFire")
  CreateThread("FireSpread")
  --[[Wait(2000)
  CreatePedFire(gPlayer, 9999999)
  PedSetHealth(gPlayer, 99999999999)-]]
 
end

CrtDltFire = function()
 
  GlobalFireData = {}
  PedFireData = {}
  VehicleFireData = {}
  DelteJunkCars = {}
  local PedDMG = 0.4
 
  while true do
   
    for i = table.getn(GlobalFireData), 1, -1 do
      local FireData = GlobalFireData[i]
      if GetTimer() - FireData["NTime"] > FireData["fTime"] then
        EffectSlowKill(FireData["fEffect"], 0.3)
        table.remove(GlobalFireData, i)
      end
    end
   
    for i = table.getn(PedFireData), 1, -1 do
      local FireData = PedFireData[i]
      if GetTimer() - FireData["NTime"] > FireData["fTime"] then
        EffectSlowKill(FireData["fEffect"], 0.3)
        table.remove(PedFireData, i)
        table.remove(BurningPeds, i)
      end
    end
   
    for i = table.getn(VehicleFireData), 1, -1 do
      local FireData = VehicleFireData[i]
      if GetTimer() - FireData["NTime"] > FireData["fTime"] then
        EffectSlowKill(FireData["fEffect"], 0.3)
        VehicleBlowUp(FireData["fVehicle"])
        table.remove(VehicleFireData, i)
        table.remove(BurningVehicles, i)
      end
    end
   
    for i = table.getn(DelteJunkCars), 1, -1 do
      local JCData = DelteJunkCars[i]
      if GetTimer() - JCData["NTime"] > JCData["DTime"] then
        DeletePersistentEntity(JCData[1], JCData[2])
        table.remove(DelteJunkCars, i)
      end
    end
   
    for i = 1, table.getn(GlobalFireData) do
      local FireData = GlobalFireData[i]
      EffectSetPosition(FireData["fEffect"], FireData[1], FireData[2], FireData[3])
    end
   
    for i = 1, table.getn(PedFireData) do
      local FireData = PedFireData[i]
      local fX, fY, fZ = PedGetPosXYZ(FireData["fPed"])
      PedApplyDamage(FireData["fPed"], PedDMG)
      EffectSetPosition(FireData["fEffect"], fX, fY, fZ)
    end
   
    for i = 1, table.getn(VehicleFireData) do
      local FireData = VehicleFireData[i]
      local fX, fY, fZ = VehicleGetPosXYZ(FireData["fVehicle"])
      EffectSetPosition(FireData["fEffect"], fX, fY, fZ)
    end
   
    Wait(25)
  end
end

FireSpread = function()
 
  BurningPeds = {}
  BurningVehicles = {}
 
 
  local FTime = 10000
 
  while true do
   
    for i, FD in ipairs(GlobalFireData) do
      for k, Ped in {PedFindInAreaXYZ(FD[1], FD[2], FD[3], 1.5)} do
        if not IsInTable(BurningPeds, Ped) then
          CreatePedFire(Ped, FTime)
        end
      end
     
      local FIND = VehicleFindInAreaXYZ(fX, fY, fZ, 4.5)
      if type(FIND) == "table" then
        for k, VEH in ipairs(FIND) do
          if not IsInTable(BurningVehicles, VEH) then
            CreateVehicleFire(VEH, 5000)
          end
        end
      end
    end
   
    for i, FD in ipairs(PedFireData) do
      local fX, fY, fZ = PedGetPosXYZ(FD["fPed"])
     
      for k, Ped in {PedFindInAreaXYZ(fX, fY, fZ, 1.5)} do
        if not IsInTable(BurningPeds, Ped) then
          CreatePedFire(Ped, FTime)
        end
      end
     
      local FIND = VehicleFindInAreaXYZ(fX, fY, fZ, 4.5)
      if type(FIND) == "table" then
        for k, VEH in ipairs(FIND) do
          if not IsInTable(BurningVehicles, VEH) then
            CreateVehicleFire(VEH, 5000)
          end
        end
      end
    end
   
    for i, FD in ipairs(VehicleFireData) do
      local fX, fY, fZ = VehicleGetPosXYZ(FD["fVehicle"])
     
      for k, Ped in {PedFindInAreaXYZ(fX, fY, fZ, 1.5)} do
        if not IsInTable(BurningPeds, Ped) then
          CreatePedFire(Ped, FTime)
        end
      end
     
      local FIND = VehicleFindInAreaXYZ(fX, fY, fZ, 4.5)
      if type(FIND) == "table" then
        for k, VEH in ipairs(FIND) do
          if not IsInTable(BurningVehicles, VEH) then
            CreateVehicleFire(VEH, 5000)
          end
        end
      end
    end
   
    Wait(0)
  end
end

CreateGlobalFire = function(gfX, gfY, gfZ, gfTime)
  local Fr = EffectCreate("GymFire", gfX, gfY, gfZ)
  local NowTime = GetTimer()
  local gfData = {gfX, gfY, gfZ, fEffect = Fr, NTime = NowTime, fTime = gfTime}
  table.insert(GlobalFireData, gfData)
end

CreatePedFire = function(Ped, pfTime)
  local fX, fY, fZ = PedGetPosXYZ(Ped)
  if PedIsInAnyVehicle(Ped) then
    PedExitVehicle(Ped)
  end
  PedStop(Ped)
  PedClearObjectives(Ped)
  PedMakeAmbient(Ped)
  PedFlee(Ped)
  local Fr = EffectCreate("GymFire", fX, fY, fZ)
  local NowTime = GetTimer()
  local pfData = {fPed = Ped, fEffect = Fr, NTime = NowTime, fTime = pfTime}
  table.insert(PedFireData, pfData)
  table.insert(BurningPeds, Ped)
end

CreateVehicleFire = function(Vehicle, vfTime)
  local fX, fY, fZ = VehicleGetPosXYZ(Vehicle)
  local Fr = EffectCreate("GymFire", fX, fY, fZ)
  local NowTime = GetTimer()
  local vfData = {fVehicle = Vehicle, fEffect = Fr, NTime = NowTime, fTime = vfTime}
  table.insert(VehicleFireData, vfData)
  table.insert(BurningVehicles, Vehicle)
end

VehicleBlowUp = function(Vehicle)
  local Scrap = {
    {308, "brocket"},
    {311, "brick"},
    {401, "wtrpipeC"},
    {402, "wtrpipeB"},
    {336, "cricket_DMG"},
    {435, "twobyfour_DMG"},
    {314, "yardstick_DMG"},
    {317, "bat_DMG"},
    {388, "CHShieldB"},
    {389, "CHShieldC"}
  }
 
  local buX, buY, buZ = VehicleGetPosXYZ(Vehicle)
  local Bu = EffectCreate("CarDestroyed", buX, buY, buZ)
  EffectSlowKill(Bu, 0.7)
  CreateGlobalFire(buX, buY, buZ, 5000)
  VehicleDelete(Vehicle)
  local JunkCar = {"DPE_JunkCarA", "DPE_JunkCarB"}
  local JCIndex, JC = CreatePersistentEntity(JunkCar[math.random(1, 2)], buX, buY, buZ - 1, math.random(1, 359), AreaGetVisible())
  table.insert(DelteJunkCars, {JCIndex, JC, NTime = GetTimer(), DTime = 5000})
 
  for i = 1, 10 do
    CreateProjectile(Scrap[math.random(1, table.getn(Scrap))][1], buX + math.random(-250, 250)/500, buY + math.random(-250, 250)/500, buZ + 2, math.random(-250, 250)/1000, math.random(-250, 250)/1000, 0.3, 10)
  end
 
  for k, Ped in {PedFindInAreaXYZ(buX, buY, buZ, 4.5)} do
    PedApplyDamage(Ped, 100)
    if not IsInTable(BurningPeds, Ped) then
      CreatePedFire(Ped, 10000)
    end
  end
 
  local FIND = VehicleFindInAreaXYZ(buX, buY, buZ, 7)
  if type(FIND) == "table" then
    for k, VEH in ipairs(FIND) do
      if not IsInTable(BurningVehicles, VEH) then
        CreateVehicleFire(VEH, 5000)
      end
    end
  end
 
end

IsInTable = function(_table, jiba)
  for v, JB in ipairs(_table) do
    if JB == jiba then
      return true
    end
  end
  return false
end

TianDiZhuZai = function()
  TutorialShowMessage("by function main", 10000)
  MinigameSetChapterCompletion("天地主宰", "出品", true, 0)
  MinigameHoldCompletion()
  Wait(2000)
  MinigameReleaseCompletion()
  repeat
    Wait(0)
  until not MinigameIsShowingCompletion()
 
  MinigameSetChapterCompletion("Fire", "mod", true, 0)
  MinigameHoldCompletion()
  Wait(1250)
  MinigameReleaseCompletion()
  repeat
    Wait(0)
  until not MinigameIsShowingCompletion()
end

F_AttendedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(false)
  PlayerSetPunishmentPoints(0)
end
 
F_MissedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(true)
  StatAddToInt(166)
end
 
F_AttendedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrintString("You got home in time for curfew", 4)
  end
end
 
F_MissedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrint("TM_TIRED5", 4, 2)
  end
end
 
F_StartClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
  local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
 
F_EndClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
end
 
F_StartMorning = function()
  F_UpdateTimeCycle()
end
 
F_EndMorning = function()
  F_UpdateTimeCycle()
end
 
F_StartLunch = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    F_UpdateTimeCycle()
    return
  end
  F_UpdateTimeCycle()
end
 
F_EndLunch = function()
  F_UpdateTimeCycle()
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
end
 
F_Nothing = function()
end
 
F_ClassWarning = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  local l_23_0 = math.random(1, 2)
end
 
F_UpdateTimeCycle = function()
  if not IsMissionCompleated("1_B") then
    local l_24_0 = GetCurrentDay(false)
    if l_24_0 < 0 or l_24_0 > 2 then
      SetCurrentDay(0)
    end
  end
  F_UpdateCurfew()
end
 
F_UpdateCurfew = function()
  local l_25_0 = shared.gCurfewRules
  if not l_25_0 then
    l_25_0 = F_CurfewDefaultRules
  end
  l_25_0()
end
 
F_CurfewDefaultRules = function()
  local l_26_0 = ClockGet()
  if l_26_0 >= 23 or l_26_0 < 7 then
    shared.gCurfew = true
  else
    shared.gCurfew = false
  end
end
U can use this three function:
CreateGlobalFire(X, Y, Z, Time)
CreatePedFire(Ped, Time)
CreateVehicleFire(Vehicle, Explosion Time)

Flame can spread to peds or vehicles

Vehicle will blow up after burn
« Last Edit: September 01, 2022, 08:09:27 PM by Ming »