- inject_gta_city.py: Full GTA-style city with 20 buildings, roads, cars, street lights, traffic lights, trees, 15 human enemies with varied skin/clothing, and 10 COD weapons with visible gun models - inject_bg.py: Background injection using SendMessage/PostMessage Win32 API - inject_bg2.py: PostMessage approach targeting main window for WPF apps - inject_cod_final.py: Working COD game injection (7-step sequential) - cod_inject.py: Combined COD game builder with proper Studio launch - roblox-fps-p1-p6: Split Lua scripts for multi-part injection Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
330 lines
23 KiB
Python
330 lines
23 KiB
Python
"""
|
|
Build a complete Call of Duty game in Roblox Studio.
|
|
Uses small sequential injections that fit in command bar.
|
|
Part 1: New place + ground
|
|
"""
|
|
import ctypes, ctypes.wintypes, subprocess, time, sys, os
|
|
|
|
user32 = ctypes.windll.user32
|
|
|
|
def find_studio():
|
|
target = [None]
|
|
def cb(hwnd, _):
|
|
l = user32.GetWindowTextLengthW(hwnd)
|
|
if l > 0:
|
|
buf = ctypes.create_unicode_buffer(l + 1)
|
|
user32.GetWindowTextW(hwnd, buf, l + 1)
|
|
if "Roblox Studio" in buf.value:
|
|
target[0] = hwnd
|
|
return False
|
|
return True
|
|
WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM)
|
|
user32.EnumWindows(WNDENUMPROC(cb), 0)
|
|
return target[0]
|
|
|
|
def focus(hwnd):
|
|
user32.ShowWindow(hwnd, 9)
|
|
time.sleep(0.3)
|
|
fg = user32.GetForegroundWindow()
|
|
if fg != hwnd:
|
|
tid_fg = user32.GetWindowThreadProcessId(fg, None)
|
|
tid_target = user32.GetWindowThreadProcessId(hwnd, None)
|
|
user32.AttachThreadInput(tid_fg, tid_target, True)
|
|
user32.SetForegroundWindow(hwnd)
|
|
user32.AttachThreadInput(tid_fg, tid_target, False)
|
|
time.sleep(0.5)
|
|
|
|
def inject_code(code, hwnd):
|
|
"""Inject Lua code into Studio command bar."""
|
|
tmp = os.path.join(os.environ["TEMP"], "rbx_inj.lua")
|
|
with open(tmp, "w", encoding="utf-8") as f:
|
|
f.write(code)
|
|
subprocess.run(["powershell", "-Command", f"Get-Content '{tmp}' -Raw | Set-Clipboard"],
|
|
capture_output=True, timeout=15)
|
|
time.sleep(0.3)
|
|
|
|
# Escape to dismiss any dialog
|
|
user32.keybd_event(0x1B, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x1B, 0, 2, 0)
|
|
time.sleep(0.2)
|
|
|
|
# Click command bar area (bottom center of window)
|
|
rect = ctypes.wintypes.RECT()
|
|
user32.GetWindowRect(hwnd, ctypes.byref(rect))
|
|
w = rect.right - rect.left
|
|
h = rect.bottom - rect.top
|
|
cx = rect.left + w // 2
|
|
cy = rect.bottom - 45
|
|
sw = user32.GetSystemMetrics(0); sh = user32.GetSystemMetrics(1)
|
|
nx = int(cx * 65535 / sw); ny = int(cy * 65535 / sh)
|
|
user32.mouse_event(0x8001, nx, ny, 0, 0); time.sleep(0.02)
|
|
user32.mouse_event(0x8002, nx, ny, 0, 0); time.sleep(0.03)
|
|
user32.mouse_event(0x8004, nx, ny, 0, 0)
|
|
time.sleep(0.4)
|
|
|
|
# Select all + delete
|
|
user32.keybd_event(0x11, 0, 0, 0) # Ctrl
|
|
user32.keybd_event(0x41, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x41, 0, 2, 0) # A
|
|
user32.keybd_event(0x11, 0, 2, 0)
|
|
time.sleep(0.1)
|
|
user32.keybd_event(0x2E, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x2E, 0, 2, 0) # Del
|
|
time.sleep(0.1)
|
|
|
|
# Paste (Ctrl+V)
|
|
user32.keybd_event(0x11, 0, 0, 0); time.sleep(0.02)
|
|
user32.keybd_event(0x56, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x56, 0, 2, 0)
|
|
time.sleep(0.02); user32.keybd_event(0x11, 0, 2, 0)
|
|
time.sleep(1.0)
|
|
|
|
# Execute (Enter)
|
|
user32.keybd_event(0x0D, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x0D, 0, 2, 0)
|
|
time.sleep(1.5)
|
|
|
|
hwnd = find_studio()
|
|
if not hwnd:
|
|
print("ERROR: Roblox Studio not found!")
|
|
sys.exit(1)
|
|
|
|
print(f"Studio found: {hwnd}")
|
|
focus(hwnd)
|
|
|
|
# Step 1: Open new place (Ctrl+N)
|
|
print("[1/8] Opening new place...")
|
|
user32.keybd_event(0x11, 0, 0, 0); time.sleep(0.02)
|
|
user32.keybd_event(0x4E, 0, 0, 0); time.sleep(0.03); user32.keybd_event(0x4E, 0, 2, 0)
|
|
time.sleep(0.02); user32.keybd_event(0x11, 0, 2, 0)
|
|
time.sleep(5)
|
|
focus(hwnd)
|
|
|
|
# Step 2: Clean + build ground
|
|
print("[2/8] Building ground + lighting...")
|
|
code2 = """
|
|
for _,v in pairs(workspace:GetChildren()) do if v:IsA("Model")or v:IsA("Part")or v:IsA("Folder")then if v.Name~="Camera"and v.Name~="Terrain"then v:Destroy()end end end
|
|
wait(0.2)
|
|
local g=Instance.new("Part",workspace)g.Name="Ground"g.Size=Vector3.new(500,2,500)g.Position=Vector3.new(0,-1,0)g.Anchored=true g.BrickColor=BrickColor.new("Dark stone grey")g.Material=Enum.Material.Asphalt
|
|
local L=game:GetService("Lighting")L.ClockTime=6 L.Brightness=0.4 L.FogEnd=600 L.FogStart=150 L.Ambient=Color3.fromRGB(60,60,80)
|
|
print("Ground done")
|
|
"""
|
|
inject_code(code2, hwnd)
|
|
print(" Ground OK")
|
|
|
|
# Step 3: Buildings
|
|
print("[3/8] Building structures...")
|
|
code3 = """
|
|
local blds={{-80,10,-100,35,22,28},{90,10,-70,28,18,32},{-50,11,80,40,24,22},{100,9,90,25,16,30},{0,13,-160,32,26,32},{-130,10,0,22,20,22},{130,10,-30,26,20,26}}
|
|
for i,b in ipairs(blds)do local m=Instance.new("Model",workspace)m.Name="Building"..i local p=Instance.new("Part",m)p.Size=Vector3.new(b[4],b[5],b[6])p.Position=Vector3.new(b[1],b[2],b[3])p.Anchored=true p.BrickColor=BrickColor.new(i%2==0 and"Medium stone grey"or"Brown")p.Material=Enum.Material.Brick p.Name="Wall"end
|
|
for _,w in ipairs({{-250,10,0,2,20,500},{250,10,0,2,20,500},{0,10,-250,500,20,2},{0,10,250,500,20,2}})do local p=Instance.new("Part",workspace)p.Size=Vector3.new(w[4],w[5],w[6])p.Position=Vector3.new(w[1],w[2],w[3])p.Anchored=true p.BrickColor=BrickColor.new("Dark stone grey")p.Material=Enum.Material.Concrete p.Transparency=0.4 p.Name="Boundary"end
|
|
print("Buildings done")
|
|
"""
|
|
inject_code(code3, hwnd)
|
|
print(" Buildings OK")
|
|
|
|
# Step 4: Cover + towers
|
|
print("[4/8] Adding cover + watchtowers...")
|
|
code4 = """
|
|
for i=1,30 do local x,z=math.random(-200,200),math.random(-200,200)local p=Instance.new("Part",workspace)p.Anchored=true p.Name="Cover"..i if i%3==0 then p.Size=Vector3.new(2,4,2)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Reddish brown")p.Material=Enum.Material.Metal p.Shape=Enum.PartType.Cylinder elseif i%3==1 then p.Size=Vector3.new(4,4,4)p.Position=Vector3.new(x,2,z)p.BrickColor=BrickColor.new("Brown")p.Material=Enum.Material.Wood else p.Size=Vector3.new(7,2.5,3)p.Position=Vector3.new(x,1.25,z)p.BrickColor=BrickColor.new("Brick yellow")p.Material=Enum.Material.Sand end end
|
|
for i=1,4 do local x,z=({-180,-180,180,180})[i],({-180,180,-180,180})[i]local t=Instance.new("Model",workspace)t.Name="Tower"..i local b=Instance.new("Part",t)b.Size=Vector3.new(6,1,6)b.Position=Vector3.new(x,0.5,z)b.Anchored=true b.BrickColor=BrickColor.new("Dark stone grey")for _,o in ipairs({{-2,0,-2},{2,0,-2},{-2,0,2},{2,0,2}})do local l=Instance.new("Part",t)l.Size=Vector3.new(1,18,1)l.Position=Vector3.new(x+o[1],9,z+o[2])l.Anchored=true l.BrickColor=BrickColor.new("Dark stone grey")end local pl=Instance.new("Part",t)pl.Size=Vector3.new(8,1,8)pl.Position=Vector3.new(x,18,z)pl.Anchored=true pl.BrickColor=BrickColor.new("Brown")pl.Material=Enum.Material.Wood end
|
|
print("Cover done")
|
|
"""
|
|
inject_code(code4, hwnd)
|
|
print(" Cover OK")
|
|
|
|
# Step 5: ReplicatedStorage + WeaponData
|
|
print("[5/8] Creating weapon system...")
|
|
code5 = """
|
|
for _,v in pairs(game.ReplicatedStorage:GetChildren())do v:Destroy()end
|
|
local sh=Instance.new("Folder",game.ReplicatedStorage)sh.Name="Shared"
|
|
local ev=Instance.new("Folder",game.ReplicatedStorage)ev.Name="Events"
|
|
for _,n in ipairs({"HitEvent","KillEvent","DamageEvent","HitMarkerEvent"})do Instance.new("RemoteEvent",ev).Name=n end
|
|
local wd=Instance.new("ModuleScript",sh)wd.Name="WeaponData"
|
|
wd.Source=[[local W={
|
|
{Name="M4A1",Cat="AR",Key=1,Dmg=28,HM=2.5,FR=0.09,MS=30,RL=2.2,Sp=0.02,ASp=0.007,Rec=0.3,Rng=350,Auto=true},
|
|
{Name="AK-47",Cat="AR",Key=2,Dmg=32,HM=2.5,FR=0.11,MS=30,RL=2.5,Sp=0.03,ASp=0.012,Rec=0.45,Rng=300,Auto=true},
|
|
{Name="SCAR-H",Cat="AR",Key=3,Dmg=38,HM=2.5,FR=0.1,MS=20,RL=2.6,Sp=0.022,ASp=0.009,Rec=0.4,Rng=400,Auto=true},
|
|
{Name="ACR 6.8",Cat="AR",Key=4,Dmg=30,HM=2.5,FR=0.075,MS=30,RL=2.0,Sp=0.015,ASp=0.005,Rec=0.25,Rng=380,Auto=true},
|
|
{Name="MP7",Cat="SMG",Key=5,Dmg=22,HM=2,FR=0.06,MS=40,RL=1.8,Sp=0.03,ASp=0.012,Rec=0.12,Rng=140,Auto=true},
|
|
{Name="MP5",Cat="SMG",Key=6,Dmg=21,HM=2,FR=0.07,MS=30,RL=1.7,Sp=0.032,ASp=0.014,Rec=0.15,Rng=150,Auto=true},
|
|
{Name="AWP",Cat="Sniper",Key=7,Dmg=120,HM=3,FR=1.5,MS=10,RL=3.5,Sp=0.001,ASp=0,Rec=2.5,Rng=900,Auto=false,Zoom=8},
|
|
{Name="Intervention",Cat="Sniper",Key=8,Dmg=98,HM=3,FR=1.2,MS=5,RL=3.0,Sp=0.002,ASp=0,Rec=3.0,Rng=850,Auto=false,Zoom=10},
|
|
{Name="SPAS-12",Cat="Shotgun",Key=9,Dmg=18,HM=1.5,FR=0.85,MS=8,RL=3.0,Sp=0.09,ASp=0.07,Rec=1.5,Rng=45,Auto=false,Pel=8},
|
|
{Name="RPG-7",Cat="Launcher",Key=0,Dmg=250,HM=1,FR=2.5,MS=1,RL=4.5,Sp=0.01,ASp=0.005,Rec=3.5,Rng=250,Auto=false,Expl=true,Blast=25},
|
|
}return W]]
|
|
print("WeaponData created with 10 weapons")
|
|
"""
|
|
inject_code(code5, hwnd)
|
|
print(" Weapons OK")
|
|
|
|
# Step 6: Game Server Script
|
|
print("[6/8] Creating game server + enemy AI...")
|
|
code6 = """
|
|
for _,v in pairs(game.ServerScriptService:GetChildren())do v:Destroy()end
|
|
local s=Instance.new("Script",game.ServerScriptService)s.Name="GameServer"
|
|
s.Source=[[
|
|
local RS=game:GetService("ReplicatedStorage")local P=game:GetService("Players")local D=game:GetService("Debris")
|
|
local E=RS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent DE=E.DamageEvent HME=E.HitMarkerEvent
|
|
P.PlayerAdded:Connect(function(pl)
|
|
local ls=Instance.new("Folder",pl)ls.Name="leaderstats"
|
|
local k=Instance.new("IntValue",ls)k.Name="Kills"k.Value=0
|
|
local d=Instance.new("IntValue",ls)d.Name="Deaths"d.Value=0
|
|
pl.CharacterAdded:Connect(function(c)local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20
|
|
h.Died:Connect(function()d.Value=d.Value+1 task.delay(4,function()if pl and pl.Parent then pl:LoadCharacter()end end)end)end)end)
|
|
HE.OnServerEvent:Connect(function(pl,hp,dmg,hs)
|
|
if hp and hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid
|
|
if hm and hm.Health>0 then local d=hs and dmg*2.5 or dmg hm:TakeDamage(d)HME:FireClient(pl,hs)
|
|
if hm.Health<=0 then KE:FireClient(pl,"Enemy")pl.leaderstats.Kills.Value=pl.leaderstats.Kills.Value+1 end end end end)
|
|
local SP={Vector3.new(-180,3,-180),Vector3.new(180,3,-180),Vector3.new(-180,3,180),Vector3.new(180,3,180),Vector3.new(0,3,-200),Vector3.new(0,3,200),Vector3.new(-200,3,0),Vector3.new(200,3,0),Vector3.new(-120,3,-120),Vector3.new(120,3,120),Vector3.new(0,3,0),Vector3.new(-60,3,60)}
|
|
local function mkE(sp)
|
|
local m=Instance.new("Model",workspace)m.Name="EnemyBot"
|
|
local t=Instance.new("Part",m)t.Name="Torso"t.Size=Vector3.new(3,3,2)t.Position=sp t.BrickColor=BrickColor.new("Dark olive green")t.Material=Enum.Material.Plastic
|
|
local h=Instance.new("Part",m)h.Name="Head"h.Size=Vector3.new(2,2,2)h.Position=sp+Vector3.new(0,2.5,0)h.BrickColor=BrickColor.new("Medium stone grey")
|
|
local ll=Instance.new("Part",m)ll.Name="Left Leg"ll.Size=Vector3.new(1,3,1)ll.Position=sp+Vector3.new(-.75,-2.5,0)ll.BrickColor=BrickColor.new("Dark olive green")
|
|
local rl=Instance.new("Part",m)rl.Name="Right Leg"rl.Size=Vector3.new(1,3,1)rl.Position=sp+Vector3.new(.75,-2.5,0)rl.BrickColor=BrickColor.new("Dark olive green")
|
|
local la=Instance.new("Part",m)la.Name="Left Arm"la.Size=Vector3.new(1,3,1)la.Position=sp+Vector3.new(-2,0,0)la.BrickColor=BrickColor.new("Dark olive green")
|
|
local ra=Instance.new("Part",m)ra.Name="Right Arm"ra.Size=Vector3.new(1,3,1)ra.Position=sp+Vector3.new(2,0,0)ra.BrickColor=BrickColor.new("Dark olive green")
|
|
local hm=Instance.new("Humanoid",m)hm.MaxHealth=100 hm.Health=100 hm.WalkSpeed=14
|
|
local rp=Instance.new("Part",m)rp.Name="HumanoidRootPart"rp.Size=Vector3.new(2,2,1)rp.Position=sp rp.Transparency=1 rp.CanCollide=false
|
|
for _,a in ipairs({{rp,t},{t,h},{t,ll},{t,rl},{t,la},{t,ra}})do local w=Instance.new("Weld")w.Part0=a[1]w.Part1=a[2]w.Parent=a[1]end
|
|
local tp=SP[math.random(#SP)]local ls=0
|
|
hm.Died:Connect(function()task.delay(6,function()if m.Parent then m:Destroy()end end)task.delay(15,function()mkE(SP[math.random(#SP)])end)end)
|
|
spawn(function()while m.Parent and hm.Health>0 do task.wait(.4)local r=m:FindFirstChild("HumanoidRootPart")if r then hm:MoveTo(tp)if(r.Position-tp).Magnitude<6 then tp=SP[math.random(#SP)]end end end end)
|
|
spawn(function()while m.Parent and hm.Health>0 do task.wait(.25)local r=m:FindFirstChild("HumanoidRootPart")if not r then continue end for _,pl in ipairs(P:GetPlayers())do if pl.Character and pl.Character:FindFirstChild("HumanoidRootPart")then local pr=pl.Character.HumanoidRootPart local d=(pr.Position-r.Position).Magnitude if d<70 then hm:MoveTo(pr.Position)if d<50 and tick()-ls>1.2 then ls=tick()local ph=pl.Character:FindFirstChild("Humanoid")if ph and ph.Health>0 then ph:TakeDamage(6+math.random(8))DE:FireClient(pl,8)end end end end end end end)
|
|
end
|
|
for i=1,12 do task.delay(i*.4,function()mkE(SP[i])end)end
|
|
print("[GameServer] 12 enemy bots spawned!")
|
|
]]
|
|
print("Server script created")
|
|
"""
|
|
inject_code(code6, hwnd)
|
|
print(" Server OK")
|
|
|
|
# Step 7: HUD
|
|
print("[7/8] Creating HUD...")
|
|
code7 = """
|
|
for _,v in pairs(game.StarterGui:GetChildren())do v:Destroy()end
|
|
local h=Instance.new("ScreenGui",game.StarterGui)h.Name="COD_HUD"h.ResetOnSpawn=false
|
|
-- Crosshair
|
|
local c1=Instance.new("Frame",h)c1.Name="CH"c1.Size=UDim2.new(0,24,0,2)c1.Position=UDim2.new(0.5,-12,0.5,-1)c1.BackgroundColor3=Color3.new(1,1,1)c1.BorderSizePixel=0
|
|
local c2=Instance.new("Frame",h)c2.Name="CV"c2.Size=UDim2.new(0,2,0,24)c2.Position=UDim2.new(0.5,-1,0.5,-12)c2.BackgroundColor3=Color3.new(1,1,1)c2.BorderSizePixel=0
|
|
-- Dot
|
|
local cd=Instance.new("Frame",h)cd.Name="CDot"cd.Size=UDim2.new(0,4,0,4)cd.Position=UDim2.new(0.5,-2,0.5,-2)cd.BackgroundColor3=Color3.fromRGB(255,50,50)cd.BorderSizePixel=0
|
|
-- Health bar
|
|
local hf=Instance.new("Frame",h)hf.Name="HP_Frame"hf.Size=UDim2.new(0,260,0,32)hf.Position=UDim2.new(0,15,1,-55)hf.BackgroundColor3=Color3.fromRGB(0,0,0)hf.BackgroundTransparency=0.4 hf.BorderSizePixel=0
|
|
local hfl=Instance.new("Frame",hf)hfl.Name="Fill"hfl.Size=UDim2.new(1,0,1,0)hfl.BackgroundColor3=Color3.fromRGB(0,180,0)hfl.BorderSizePixel=0
|
|
local htx=Instance.new("TextLabel",hf)htx.Size=UDim2.new(1,0,1,0)htx.BackgroundTransparency=1 htx.TextColor3=Color3.new(1,1,1)htx.TextStrokeTransparency=0.5 htx.Font=Enum.Font.GothamBold htx.TextSize=16 htx.Text="100"
|
|
-- Ammo
|
|
local af=Instance.new("Frame",h)af.Name="Ammo_Frame"af.Size=UDim2.new(0,220,0,65)af.Position=UDim2.new(1,-235,1,-75)af.BackgroundTransparency=1
|
|
local at=Instance.new("TextLabel",af)at.Name="AmmoTxt"at.Size=UDim2.new(1,0,0.6,0)at.BackgroundTransparency=1 at.TextColor3=Color3.new(1,1,1)at.TextStrokeTransparency=0.5 at.Font=Enum.Font.GothamBold at.TextSize=30 at.TextXAlignment=Enum.TextXAlignment.Right at.Text="30 | 30"
|
|
local wn=Instance.new("TextLabel",af)wn.Name="WepName"wn.Size=UDim2.new(1,0,0.4,0)wn.Position=UDim2.new(0,0,.6,0)wn.BackgroundTransparency=1 wn.TextColor3=Color3.fromRGB(180,180,180)wn.Font=Enum.Font.Gotham wn.TextSize=13 wn.TextXAlignment=Enum.TextXAlignment.Right wn.Text="M4A1"
|
|
-- Score
|
|
local sf=Instance.new("Frame",h)sf.Size=UDim2.new(0,180,0,36)sf.Position=UDim2.new(0.5,-90,0,8)sf.BackgroundColor3=Color3.fromRGB(0,0,0)sf.BackgroundTransparency=0.5 sf.BorderSizePixel=0
|
|
local st=Instance.new("TextLabel",sf)st.Name="ScoreTxt"st.Size=UDim2.new(1,0,1,0)st.BackgroundTransparency=1 st.TextColor3=Color3.new(1,1,1)st.Font=Enum.Font.GothamBold st.TextSize=18 st.Text="KILLS: 0"
|
|
-- Kill feed
|
|
local kf=Instance.new("Frame",h)kf.Name="KillFeed"kf.Size=UDim2.new(0,240,0,180)kf.Position=UDim2.new(1,-250,0,8)kf.BackgroundTransparency=1
|
|
Instance.new("UIListLayout",kf)
|
|
-- Hit marker
|
|
local hm=Instance.new("Frame",h)hm.Name="HitMark"hm.Size=UDim2.new(0,30,0,30)hm.Position=UDim2.new(0.5,-15,0.5,-15)hm.BackgroundTransparency=1 hm.Visible=false
|
|
for _,a in ipairs({{15,0,45},{0,15,45}})do local f=Instance.new("Frame",hm)f.Size=UDim2.new(0,14,0,3)f.Position=UDim2.new(0,a[1],0,a[2])f.Rotation=45 f.BackgroundColor3=Color3.new(1,1,1)f.BorderSizePixel=0 end
|
|
-- Reload bar
|
|
local rb=Instance.new("Frame",h)rb.Name="ReloadBar"rb.Size=UDim2.new(0,180,0,5)rb.Position=UDim2.new(0.5,-90,1,-100)rb.BackgroundColor3=Color3.fromRGB(50,50,50)rb.BorderSizePixel=0 rb.Visible=false rb.BackgroundTransparency=0.3
|
|
local rf=Instance.new("Frame",rb)rf.Name="Fill"rf.Size=UDim2.new(0,0,1,0)rf.BackgroundColor3=Color3.fromRGB(255,200,0)rf.BorderSizePixel=0
|
|
-- Weapon slots bar
|
|
local wb=Instance.new("Frame",h)wb.Name="WepBar"wb.Size=UDim2.new(0,400,0,28)wb.Position=UDim2.new(0.5,-200,1,-28)wb.BackgroundColor3=Color3.fromRGB(10,10,10)wb.BackgroundTransparency=0.5 wb.BorderSizePixel=0
|
|
local slts={{"1-4 AR",100,150,255},{"5-6 SMG",100,255,100},{"7-8 SNIPER",255,80,80},{"9 SHOTGUN",255,200,50},{"0 RPG",255,130,50}}
|
|
for i,s in ipairs(slts)do local l=Instance.new("TextLabel",wb)l.Size=UDim2.new(1/#slts,0,1,0)l.Position=UDim2.new((i-1)/#slts,0,0,0)l.BackgroundColor3=Color3.fromRGB(s[2],s[3],s[4])l.BackgroundTransparency=0.6 l.TextColor3=Color3.new(1,1,1)l.Font=Enum.Font.GothamBold l.TextSize=10 l.Text=s[1]end
|
|
print("HUD created")
|
|
"""
|
|
inject_code(code7, hwnd)
|
|
print(" HUD OK")
|
|
|
|
# Step 8: Player scripts
|
|
print("[8/8] Creating player controller + weapon system...")
|
|
code8 = """
|
|
for _,v in pairs(game.StarterPlayer.StarterPlayerScripts:GetChildren())do v:Destroy()end
|
|
local ps=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)ps.Name="PlayerSetup"
|
|
ps.Source=[[
|
|
local P=game:GetService("Players")local RS=game:GetService("RunService")local UI=game:GetService("UserInputService")local RepS=game:GetService("ReplicatedStorage")local TS=game:GetService("TweenService")
|
|
local pl=P.LocalPlayer cam=workspace.CurrentCamera
|
|
pl.CharacterAdded:Connect(function(c)
|
|
local h=c:WaitForChild("Humanoid")h.MaxHealth=100 h.Health=100 h.WalkSpeed=20
|
|
RS.RenderStepped:Connect(function()if h.Health>0 then cam.CameraType=Enum.CameraType.LockFirstPerson local hd=c:FindFirstChild("Head")if hd then cam.CFrame=hd.CFrame end end end)
|
|
local sp,cr=false,false
|
|
UI.InputBegan:Connect(function(i,g)if g then return end
|
|
if i.KeyCode==Enum.KeyCode.LeftShift then sp=true h.WalkSpeed=32 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=true h.WalkSpeed=10 end end)
|
|
UI.InputEnded:Connect(function(i)
|
|
if i.KeyCode==Enum.KeyCode.LeftShift then sp=false h.WalkSpeed=cr and 10 or 20 elseif i.KeyCode==Enum.KeyCode.LeftControl then cr=false h.WalkSpeed=sp and 32 or 20 end end)
|
|
end)
|
|
]]
|
|
local wc=Instance.new("LocalScript",game.StarterPlayer.StarterPlayerScripts)wc.Name="WeaponCtrl"
|
|
wc.Source=[[
|
|
local P=game:GetService("Players")local RS=game:GetService("RunService")local UI=game:GetService("UserInputService")local RepS=game:GetService("ReplicatedStorage")local TS=game:GetService("TweenService")local D=game:GetService("Debris")
|
|
local pl=P.LocalPlayer cam=workspace.CurrentCamera ms=pl:GetMouse()
|
|
local E=RepS:WaitForChild("Events")local HE=E.HitEvent KE=E.KillEvent HME=E.HitMarkerEvent
|
|
local WD=require(RepS:WaitForChild("Shared"):WaitForChild("WeaponData"))
|
|
local ci=1 ammo={} isR=false isA=false canS=true ro=0 so=0 kills=0 holdM=false
|
|
for i,w in ipairs(WD)do ammo[i]=w.MS end
|
|
local km={}for i,w in ipairs(WD)do km[tostring(w.Key)]=i end
|
|
local function hud()return pl.PlayerGui:FindFirstChild("COD_HUD")end
|
|
local function sw(idx)
|
|
if idx<1 or idx>#WD or isR then return end ci=idx local w=WD[ci]
|
|
isA=false cam.FieldOfView=70 ro=0 so=0
|
|
local h=hud()if h then h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.MS h.Ammo_Frame.WepName.Text=w.Name end end
|
|
UI.InputBegan:Connect(function(i,g)if g then return end
|
|
local kn=tostring(i.KeyCode.Value)if km[kn]then sw(km[kn])end
|
|
if i.UserInputType==Enum.UserInputType.MouseButton2 then local w=WD[ci]
|
|
if w.Zoom then isA=true cam.FieldOfView=70/w.Zoom else isA=true TS:Create(cam,TweenInfo.new(.15),{FieldOfView=50}):Play()end end
|
|
if i.KeyCode==Enum.KeyCode.R and not isR then local w=WD[ci]if ammo[ci]<w.MS then isR=true canS=false
|
|
local h=hud()if h then h.ReloadBar.Visible=true local f=h.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(w.RL),{Size=UDim2.new(1,0,1,0)}):Play()end
|
|
task.delay(w.RL,function()ammo[ci]=w.MS isR=false canS=true local h=hud()if h then h.ReloadBar.Visible=false h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.MS end end)end end end)
|
|
UI.InputEnded:Connect(function(i)if i.UserInputType==Enum.UserInputType.MouseButton2 then isA=false TS:Create(cam,TweenInfo.new(.15),{FieldOfView=70}):Play()end end)
|
|
local function shoot()
|
|
local w=WD[ci]if not canS or isR or ammo[ci]<=0 then return end ammo[ci]=ammo[ci]-1
|
|
local h=hud()if h then h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..w.MS end
|
|
local c=pl.Character if not c or not c:FindFirstChild("Head")then return end
|
|
local hd=c.Head local sp=isA and w.ASp or w.Sp sp=sp+so
|
|
local dir=(ms.Hit.Position-hd.Position).Unit+Vector3.new((math.random()-.5)*sp,(math.random()-.5)*sp,(math.random()-.5)*sp).Unit
|
|
local rp=RaycastParams.new()rp.FilterType=Enum.RaycastFilterType.Exclude rp.FilterDescendantsInstances={c}
|
|
local pe=w.Pel or 1
|
|
for p=1,pe do local d=dir if pe>1 then d=dir+Vector3.new((math.random()-.5)*w.Sp*2,(math.random()-.5)*w.Sp*2,(math.random()-.5)*w.Sp*2).Unit end
|
|
local r=workspace:Raycast(hd.Position,d*w.Rng,rp)
|
|
if r then local hp=r.Instance local hs=hp.Name=="Head"
|
|
local tr=Instance.new("Part",workspace)tr.Size=Vector3.new(.1,.1,(r.Position-hd.Position).Magnitude)tr.CFrame=CFrame.lookAt(hd.Position,r.Position)*CFrame.new(0,0,-tr.Size.Z/2)tr.Anchored=true tr.CanCollide=false tr.BrickColor=BrickColor.new("New Yeller")tr.Material=Enum.Material.Neon tr.Transparency=.4 D:AddItem(tr,.12)
|
|
local sp2=Instance.new("Part",workspace)sp2.Size=Vector3.new(.3,.3,.3)sp2.Position=r.Position sp2.Anchored=true sp2.CanCollide=false sp2.BrickColor=BrickColor.new("Bright orange")sp2.Material=Enum.Material.Neon D:AddItem(sp2,.08)
|
|
if w.Expl then local ex=Instance.new("Explosion",workspace)ex.Position=r.Position ex.BlastRadius=w.Blast or 25 ex.BlastPressure=500000 end
|
|
if hp.Parent and hp.Parent:FindFirstChild("Humanoid")then local hm=hp.Parent.Humanoid
|
|
if hm and hm.Health>0 then local dm=hs and w.Dmg*w.HM or w.Dmg HE:FireServer(hp,dm,hs)
|
|
if hm.Health<=0 then kills=kills+1 local h=hud()if h then h.ScoreFrame.ScoreTxt.Text="KILLS: "..kills end KE:FireServer("Enemy")end end end end end
|
|
ro=math.min(ro+w.Rec,w.Rec*5)so=math.min(so+w.Sp*.5,w.Sp*3)
|
|
if ammo[ci]<=0 then task.delay(.2,function()if ammo[ci]<=0 and not isR then isR=true canS=false local ww=WD[ci]local h=hud()if h then h.ReloadBar.Visible=true local f=h.ReloadBar.Fill f.Size=UDim2.new(0,0,1,0)TS:Create(f,TweenInfo.new(ww.RL),{Size=UDim2.new(1,0,1,0)}):Play()end
|
|
task.delay(ww.RL,function()ammo[ci]=ww.MS isR=false canS=true local h=hud()if h then h.ReloadBar.Visible=false h.Ammo_Frame.AmmoTxt.Text=ammo[ci].." | "..ww.MS end end)end end)end end
|
|
UI.InputBegan:Connect(function(i,g)if g then return end
|
|
if i.UserInputType==Enum.UserInputType.MouseButton1 then holdM=true local w=WD[ci]
|
|
if w.Auto then spawn(function()while holdM and canS do shoot()task.wait(w.FR)end end)elseif w.Burst then for b=1,w.Burst do shoot()task.wait(w.FR)end else shoot()end end end)
|
|
UI.InputEnded:Connect(function(i)if i.UserInputType==Enum.UserInputType.MouseButton1 then holdM=false end end)
|
|
RS.RenderStepped:Connect(function()ro=math.max(ro-.12,0)so=math.max(so-.008,0)end)
|
|
sw(1)print("[WeaponCtrl] 10 COD weapons loaded!")
|
|
]]
|
|
print("Player scripts created - GAME READY!")
|
|
"""
|
|
inject_code(code8, hwnd)
|
|
print(" Player scripts OK")
|
|
|
|
# Final: Press F5 to start
|
|
print("\nStarting Play mode...")
|
|
time.sleep(1)
|
|
focus(hwnd)
|
|
user32.keybd_event(0x74, 0, 0, 0); time.sleep(0.05); user32.keybd_event(0x74, 0, 2, 0)
|
|
|
|
print("\n" + "=" * 55)
|
|
print(" CALL OF DUTY - ROBLOX EDITION")
|
|
print(" 10 Weapons | 12 Enemy Bots | Urban Map")
|
|
print("=" * 55)
|
|
print(" CONTROLS:")
|
|
print(" WASD = Move LMB = Shoot RMB = ADS/Scope")
|
|
print(" Shift = Sprint Ctrl = Crouch R = Reload")
|
|
print("")
|
|
print(" WEAPONS:")
|
|
print(" 1 = M4A1 2 = AK-47 3 = SCAR-H")
|
|
print(" 4 = ACR 6.8 5 = MP7 6 = MP5")
|
|
print(" 7 = AWP 8 = Intervention 9 = SPAS-12")
|
|
print(" 0 = RPG-7")
|
|
print("=" * 55)
|