RegisterCommand("tw_coords_ground", function() local ped = PlayerPedId() local c = GetEntityCoords(ped) local h = GetEntityHeading(ped) local found, groundZ = GetGroundZFor_3dCoord(c.x, c.y, c.z + 200.0, 0) local z = found and groundZ or c.z local msg = ("Ground Coords: vector4(%.3f, %.3f, %.3f, %.1f)"):format(c.x, c.y, z, h) print("^3[turfwar]^7 " .. msg) BeginTextCommandThefeedPost("STRING") AddTextComponentSubstringPlayerName(msg) EndTextCommandThefeedPostTicker(false, false) end, false) RegisterCommand("tw_hudtest", function() SendNUIMessage({ type="capture:start", turfName="HUD TEST", fill="rgba(255,0,0,0.9)", bg="rgba(255,255,255,0.14)" }) Wait(250) SendNUIMessage({ type="capture:set", t=0.5 }) end) RegisterCommand("tw_coords_turf", function() local ped = PlayerPedId() local c = GetEntityCoords(ped) local found, groundZ = GetGroundZFor_3dCoord(c.x, c.y, c.z + 200.0, 0) local z = found and groundZ or c.z local msg = ("center = vector3(%.3f, %.3f, %.3f),"):format(c.x, c.y, z) print("^3[turfwar]^7 " .. msg) BeginTextCommandThefeedPost("STRING") AddTextComponentSubstringPlayerName(msg) EndTextCommandThefeedPostTicker(false, false) end, false) -- client/dev.lua (or bottom of client/main.lua) RegisterCommand("tw_uniform_dump", function() local ped = PlayerPedId() if not ped or ped == 0 then return end print("^3[turfwar]^7 ===== UNIFORM DUMP START =====") -- Components 0..11 for compId = 0, 11 do local drawable = GetPedDrawableVariation(ped, compId) local texture = GetPedTextureVariation(ped, compId) print(("[turfwar] component: { id=%d, drawable=%d, texture=%d }"):format(compId, drawable, texture)) end -- Props commonly used: 0..2, 6..7 local propIds = {0,1,2,6,7} for _, propId in ipairs(propIds) do local drawable = GetPedPropIndex(ped, propId) -- -1 = none local texture = GetPedPropTextureIndex(ped, propId) print(("[turfwar] prop: { id=%d, drawable=%d, texture=%d }"):format(propId, drawable, texture)) end print("^3[turfwar]^7 ===== UNIFORM DUMP END =====") end, false) RegisterCommand("tw_uniform_test", function(_, args) local gangId = tonumber(args[1] or "0") or 0 print(("^3[turfwar]^7 Testing uniform gangId=%d"):format(gangId)) ApplyGangUniform(gangId) ReapplyUniformForSeconds(gangId, 3) end, false) local twCycleRunning = false RegisterCommand("tw_cycle", function(_, args) local ped = PlayerPedId() if not ped or ped == 0 then return end -- Toggle OFF if already running if twCycleRunning then twCycleRunning = false print("^2[turfwar]^7 Cycling stopped.") return end if not args[1] then print("^3[turfwar]^7 Usage:") print("^3[turfwar]^7 /tw_cycle ") print("^3[turfwar]^7 /tw_cycle c ") return end local mode = "prop" local id if args[1] == "c" then mode = "comp" id = tonumber(args[2]) else id = tonumber(args[1]) end if id == nil then print("^1[turfwar]^7 Invalid ID.") return end twCycleRunning = true print("^3[turfwar]^7 Cycling started. Run /tw_cycle again to stop.") CreateThread(function() if mode == "prop" then local count = GetNumberOfPedPropDrawableVariations(ped, id) print(("[turfwar] PROP id=%d count=%d"):format(id, count)) for d = 0, count - 1 do if not twCycleRunning then break end ClearPedProp(ped, id) SetPedPropIndex(ped, id, d, 0, true) print(("[turfwar] prop id=%d drawable=%d"):format(id, d)) Wait(700) end else local count = GetNumberOfPedDrawableVariations(ped, id) print(("[turfwar] COMPONENT id=%d count=%d"):format(id, count)) for d = 0, count - 1 do if not twCycleRunning then break end SetPedComponentVariation(ped, id, d, 0, 0) print(("[turfwar] comp id=%d drawable=%d"):format(id, d)) Wait(700) end end twCycleRunning = false print("^2[turfwar]^7 Cycling finished.") end) end, false) RegisterCommand("tw_showitem", function(_, args) local ped = PlayerPedId() if not ped or ped == 0 then return end local mode = args[1] -- "c" or "p" local id = tonumber(args[2]) local drawable = tonumber(args[3]) local texture = tonumber(args[4] or "0") or 0 if (mode ~= "c" and mode ~= "p" and mode ~= "comp" and mode ~= "prop") or id == nil or drawable == nil then print("^3[turfwar]^7 Usage:") print("^3[turfwar]^7 /tw_showitem c [texture]") print("^3[turfwar]^7 /tw_showitem p [texture]") return end if mode == "comp" then mode = "c" end if mode == "prop" then mode = "p" end if mode == "c" then local count = GetNumberOfPedDrawableVariations(ped, id) if count <= 0 then print("^1[turfwar]^7 This model has no drawables for that component id.") return end if drawable < 0 or drawable >= count then print(("^1[turfwar]^7 Invalid component drawable. Range 0..%d"):format(count - 1)) return end local texCount = GetNumberOfPedTextureVariations(ped, id, drawable) if texCount > 0 and (texture < 0 or texture >= texCount) then texture = 0 end SetPedComponentVariation(ped, id, drawable, texture, 0) print(("[turfwar] SET component id=%d drawable=%d texture=%d (textures=%d)"):format(id, drawable, texture, texCount)) return end -- mode == "p" local count = GetNumberOfPedPropDrawableVariations(ped, id) if drawable < 0 then ClearPedProp(ped, id) print(("[turfwar] CLEARED prop id=%d"):format(id)) return end if count <= 0 then print("^1[turfwar]^7 This model has no drawables for that prop id.") return end if drawable >= count then print(("^1[turfwar]^7 Invalid prop drawable. Range 0..%d"):format(count - 1)) return end local texCount = GetNumberOfPedPropTextureVariations(ped, id, drawable) if texCount > 0 and (texture < 0 or texture >= texCount) then texture = 0 end ClearPedProp(ped, id) SetPedPropIndex(ped, id, drawable, texture, true) print(("[turfwar] SET prop id=%d drawable=%d texture=%d (textures=%d)"):format(id, drawable, texture, texCount)) end, false) RegisterCommand("tw_hairtest", function() local ped = PlayerPedId() if not ped or ped == 0 then return end local model = GetEntityModel(ped) local isFree = (model == joaat("mp_m_freemode_01") or model == joaat("mp_f_freemode_01")) print(("[turfwar] hairtest model=%s freemode=%s"):format(tostring(model), isFree and "YES" or "NO")) -- Make sure hair is visible (no helmet/hat) ClearPedProp(ped, 0) -- Force a visible haircut refresh local hairDrawable = GetPedDrawableVariation(ped, 2) local hairTexture = GetPedTextureVariation(ped, 2) SetPedComponentVariation(ped, 2, hairDrawable, hairTexture, 0) -- Set a VERY obvious color (bright red) SetPedHairColor(ped, 8, 8) -- Read back safely local c1, c2 = GetPedHairColor(ped) print(("[turfwar] hairtest after set -> primary=%s highlight=%s (hair drawable=%s tex=%s)") :format(tostring(c1), tostring(c2), tostring(hairDrawable), tostring(hairTexture))) end, false) RegisterCommand("tw_haircycle", function() local ped = PlayerPedId() if not ped or ped == 0 then return end ClearPedProp(ped, 0) -- remove hat local count = GetNumberOfPedDrawableVariations(ped, 2) print(("[turfwar] hair drawables available: %d"):format(count)) for d = 0, count - 1 do SetPedComponentVariation(ped, 2, d, 0, 0) SetPedHairColor(ped, 8, 8) -- bright red print(("[turfwar] hair drawable=%d color=8"):format(d)) Wait(700) end end, false) RegisterCommand("tw_model", function() local ped = PlayerPedId() local m = GetEntityModel(ped) print(("[turfwar] current ped model hash=%s"):format(tostring(m))) end, false) print("^2[turfwar]^7 dev_clothing.lua loaded (clothing stepper)") local function notify(msg) BeginTextCommandThefeedPost("STRING") AddTextComponentSubstringPlayerName(msg) EndTextCommandThefeedPostTicker(false, false) end -- Step a CLOTHING COMPONENT by +/-1 -- Usage: /tw_comp RegisterCommand("tw_comp", function(_, args) local compId = tonumber(args[1]) local dir = args[2] if compId == nil or (dir ~= "next" and dir ~= "prev") then notify("Usage: /tw_comp ") return end local ped = PlayerPedId() if ped == 0 then return end local cur = GetPedDrawableVariation(ped, compId) local max = GetNumberOfPedDrawableVariations(ped, compId) if max <= 0 then notify(("Component %d has no drawables"):format(compId)) return end local new = cur if dir == "next" then new = (cur + 1) % max else new = cur - 1 if new < 0 then new = max - 1 end end SetPedComponentVariation(ped, compId, new, 0, 0) notify(("Component %d → drawable %d / %d"):format(compId, new, max - 1)) end, false) -- Step a PROP by +/-1 -- Usage: /tw_prop RegisterCommand("tw_prop", function(_, args) local propId = tonumber(args[1]) local dir = args[2] if propId == nil or (dir ~= "next" and dir ~= "prev") then notify("Usage: /tw_prop ") return end local ped = PlayerPedId() if ped == 0 then return end local cur = GetPedPropIndex(ped, propId) local max = GetNumberOfPedPropDrawableVariations(ped, propId) if max <= 0 then notify(("Prop %d has no drawables"):format(propId)) return end local new = cur if dir == "next" then new = cur + 1 if new >= max then new = -1 end else new = cur - 1 if new < -1 then new = max - 1 end end ClearPedProp(ped, propId) if new >= 0 then SetPedPropIndex(ped, propId, new, 0, true) end notify(("Prop %d → drawable %d"):format(propId, new)) end, false) -- Dump current outfit (components + props) RegisterCommand("tw_dumpfit", function() local ped = PlayerPedId() if ped == 0 then return end print("^3[turfwar]^7 ===== OUTFIT DUMP =====") for i = 0, 11 do local d = GetPedDrawableVariation(ped, i) local t = GetPedTextureVariation(ped, i) print(("component %d: drawable=%d texture=%d"):format(i, d, t)) end for p = 0, 7 do local d = GetPedPropIndex(ped, p) local t = GetPedPropTextureIndex(ped, p) print(("prop %d: drawable=%d texture=%d"):format(p, d, t)) end print("^3[turfwar]^7 =======================") end, false) -- Step TEXTURE for a COMPONENT RegisterCommand("tw_tex", function(_, args) local mode = args[1] -- 'c' or 'p' local id = tonumber(args[2]) local dir = args[3] if (mode ~= "c" and mode ~= "p") or not id or (dir ~= "next" and dir ~= "prev") then print("^3[turfwar]^7 Usage:") print("^3[turfwar]^7 /tw_tex c ") print("^3[turfwar]^7 /tw_tex p ") return end local ped = PlayerPedId() if ped == 0 then return end if mode == "c" then local drawable = GetPedDrawableVariation(ped, id) local curTex = GetPedTextureVariation(ped, id) local maxTex = GetNumberOfPedTextureVariations(ped, id, drawable) if maxTex <= 0 then print(("^1[turfwar]^7 Component %d has no textures"):format(id)) return end local newTex = curTex if dir == "next" then newTex = (curTex + 1) % maxTex else newTex = curTex - 1 if newTex < 0 then newTex = maxTex - 1 end end SetPedComponentVariation(ped, id, drawable, newTex, 0) print(("[turfwar] comp %d texture → %d / %d"):format(id, newTex, maxTex - 1)) else -- prop local drawable = GetPedPropIndex(ped, id) if drawable < 0 then print(("^1[turfwar]^7 Prop %d not currently worn"):format(id)) return end local curTex = GetPedPropTextureIndex(ped, id) local maxTex = GetNumberOfPedPropTextureVariations(ped, id, drawable) if maxTex <= 0 then print(("^1[turfwar]^7 Prop %d has no textures"):format(id)) return end local newTex = curTex if dir == "next" then newTex = (curTex + 1) % maxTex else newTex = curTex - 1 if newTex < 0 then newTex = maxTex - 1 end end SetPedPropIndex(ped, id, drawable, newTex, true) print(("[turfwar] prop %d texture → %d / %d"):format(id, newTex, maxTex - 1)) end end, false)