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


Author Topic: Nerd Tank  (Read 692 times)

0 Members and 1 Guest are viewing this topic.

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Nerd Tank
« on: May 04, 2022, 09:44:37 PM »
Code: [Select]
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("Chariot1")
  CreateThread("Chariot2")
  CreateThread("Chariot3")
  CreateThread("Chariot4")
  CreateThread("DestroyCar")
 
end

DestroyCar = function()
  while true do
    if true or (VehicleIsValid(NerdChariot) and PedIsInVehicle(gPlayer, NerdChariot)) then
      local gPX, gPY, gPZ = PedGetPosXYZ(gPlayer)
      local AllVehicles = VehicleFindInAreaXYZ(gPX, gPY, gPZ, 30)
      if type(AllVehicles) == "table" then
        for VHCNumber, Vehicle in ipairs(AllVehicles) do
         
          if VehicleIsValid(Vehicle) and not VehicleIsModel(Vehicle, 272) and not VehicleIsModel(Vehicle, 273) and not VehicleIsModel(Vehicle, 274) and not VehicleIsModel(Vehicle, 275) and not VehicleIsModel(Vehicle, 276) and not VehicleIsModel(Vehicle, 277) and not VehicleIsModel(Vehicle, 278) and not VehicleIsModel(Vehicle, 279) and not VehicleIsModel(Vehicle, 280) and not VehicleIsModel(Vehicle, 281) and not VehicleIsModel(Vehicle, 282) and not VehicleIsModel(Vehicle, 283) and not VehicleIsModel(Vehicle, 284) and not VehicleIsModel(Vehicle, 289) then
           
            if CarIsDamage(Vehicle) then
             
              local Effect1 = EffectCreate("CarDestroyed", VehicleGetPosXYZ(Vehicle))
              EffectSlowKill(Effect1, 0.5)
             
              VehicleDelete(Vehicle)
             
            end
           
          end
        end
      end
    end
    Wait(0)
  end
end

CarIsDamage = function(car)
  if CarGetDamageNumber(car) == 1 then
    return true
  elseif CarGetDamageNumber(car) == 2 then
    return true
  elseif CarGetDamageNumber(car) == 3 then
    return true
  elseif CarGetDamageNumber(car) == 4 then
    return true
  elseif CarGetDamageNumber(car) == 5 then
    return true
  elseif CarGetDamageNumber(car) == 6 then
    return true
  elseif CarGetDamageNumber(car) == 7 then
    return true
  elseif CarGetDamageNumber(car) == 8 then
    return true
  elseif CarGetDamageNumber(car) == 9 then
    return true
  elseif CarGetDamageNumber(car) == 10 then
    return true
  elseif CarGetDamageNumber(car) == 11 then
    return true
  elseif CarGetDamageNumber(car) == 12 then
    return true
  elseif CarGetDamageNumber(car) == 13 then
    return true
  elseif CarGetDamageNumber(car) == 14 then
    return true
  elseif CarGetDamageNumber(car) == 15 then
    return true
  else
    return false
  end
end

Chariot1 = function()
  while true do
   
    if not VehicleIsValid(NerdChariot) and PedIsInAreaXYZ(gPlayer, 191.8, -6, 6, 50, 0) then
     
      NerdChariot = VehicleCreateXYZ(288, 191.8, -6, 6) --41.5, -133.3, 3
     
    end
   
    Wait(500)
  end
end

Chariot2 = function()
  while true do
   
    if VehicleIsValid(NerdChariot) and PedIsInVehicle(gPlayer, NerdChariot) then
     
      local HX, HY, HZ = PedGetHeadPos(gPlayer)
      local Heading = PedGetHeading(gPlayer)
      local DeltaX = -math.sin(Heading)
      local DeltaY = math.cos(Heading)
      if math.deg(Heading) > 0 then
        Rotation = math.deg(Heading) - 180
      else
        Rotation = math.deg(Heading) + 179.99
      end
      QiangIndex, Qiang = CreatePersistentEntity("WPCannon", HX + DeltaX, HY + DeltaY, HZ + 2, Rotation, AreaGetVisible())
      repeat
       
        DeletePersistentEntity(QiangIndex, Qiang)
        local HX, HY, HZ = PedGetHeadPos(gPlayer)
        local Heading = PedGetHeading(gPlayer)
        local DeltaX = -math.sin(Heading)
        local DeltaY = math.cos(Heading)
        if math.deg(Heading) > 0 then
          Rotation = math.deg(Heading) - 180
        else
          Rotation = math.deg(Heading) + 179.99
        end
        QiangIndex, Qiang = CreatePersistentEntity("WPCannon", HX + DeltaX, HY + DeltaY, HZ + 0.6, Rotation, AreaGetVisible())
       
        Wait(0)
      until not PedIsInVehicle(gPlayer, NerdChariot)
     
      DeletePersistentEntity(QiangIndex, Qiang)
     
    end
   
    Wait(0)
  end
end

Chariot3 = function()
  while true do
   
    if IsButtonPressed(6, 0) and PedIsInVehicle(gPlayer, NerdChariot) then
     
      ChariotShotgun()
      Wait(80)
      ChariotFire()
      Wait(0)
      ChariotFire()
      Wait(0)
      ChariotFire()
      Wait(0)
      ChariotFire()
      Wait(0)
      ChariotFire()
      Wait(0)
      ChariotFire()
      Wait(70)
     
    end
   
    Wait(0)
  end
end

ChariotFire = function()
  local HX, HY, HZ = PedGetHeadPos(gPlayer)
  local Heading = PedGetHeading(gPlayer)
  local DeltaX = -math.sin(Heading)
  local DeltaY = math.cos(Heading)
  Effect1 = EffectCreate("SGTargetHit", HX + DeltaX*1.8, HY + DeltaY*1.8, HZ + 0.8)
  EffectSlowKill(Effect1, 0.1)
  CreateProjectile(308, HX + DeltaX*1.5, HY + DeltaY*1.5, HZ + 1, DeltaX*2, DeltaY*2, -0.3, 50)
 
end

ChariotShotgun = function()
  for i = 1, 6 do
    local HX, HY, HZ = PedGetHeadPos(gPlayer)
    local Heading = PedGetHeading(gPlayer)
    local DeltaX = -math.sin(Heading)
    local DeltaY = math.cos(Heading)
    Effect1 = EffectCreate("SGTargetHit", HX + DeltaX*1.8, HY + DeltaY*1.8, HZ + 0.8)
    EffectSlowKill(Effect1, 0.1)
    CreateProjectile(316, HX + DeltaX*1.5, HY + DeltaY*1.5, HZ + 1, DeltaX*4 + math.random(-200, 200)/1000, DeltaY*4 + math.random(-200, 200)/1000, -0.4 + math.random(-200, 200)/1000, 100)
    Wait(0)
  end
end

Chariot4 = function()
  PedSetFlag(gPlayer, 42, true)
  while true do
   
    if VehicleIsValid(NerdChariot) then
     
      local TX, TY, TZ = VehicleGetPosXYZ(NerdChariot)
     
      if PedIsInAreaXYZ(gPlayer, TX, TY, TZ, 3) and not PedIsInAnyVehicle(gPlayer) then
       
        if IsButtonBeingPressed(9, 0) then
         
        end
       
      end
     
    end
   
    Wait(0)
  end
end
This mod make player drive the Tank and fire cannon, all functions are working fine, only the cannon can't destroy cars, the car can be destroyed with punch,but not cannon