85 lines
2.8 KiB
Lua
85 lines
2.8 KiB
Lua
-- dev.lua
|
|
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)
|
|
|
|
-- =========================================================
|
|
-- Killfeed NUI Self-Test (no PvP needed)
|
|
-- =========================================================
|
|
RegisterCommand("tw_kf", function(_, args)
|
|
local killer = args[1] or "O'Neil Tester"
|
|
local victim = args[2] or "Malita Tester"
|
|
|
|
-- Example: Gang 1 (yellow) kills Gang 2 (green)
|
|
local killerGang = tonumber(args[3]) or 1
|
|
local victimGang = tonumber(args[4]) or 2
|
|
|
|
local function rgbForGang(gangId)
|
|
local g = Config and Config.GANGS and Config.GANGS[tonumber(gangId) or 0]
|
|
if g and type(g.rgb) == "table" then
|
|
return { tonumber(g.rgb[1]) or 255, tonumber(g.rgb[2]) or 255, tonumber(g.rgb[3]) or 255 }
|
|
end
|
|
return {255,255,255}
|
|
end
|
|
|
|
SendNUIMessage({
|
|
type = "killfeed:add",
|
|
killerName= killer,
|
|
victimName= victim,
|
|
weapon = "Carbine Rifle",
|
|
headshot = true,
|
|
distance = 42,
|
|
killerRgb = rgbForGang(killerGang),
|
|
victimRgb = rgbForGang(victimGang),
|
|
})
|
|
|
|
print(("^2[turfwar]^7 Killfeed test sent -> %s (g%d) killed %s (g%d)"):format(killer, killerGang, victim, victimGang))
|
|
end, false)
|
|
|
|
RegisterCommand("tw_coords_ground", function()
|
|
local ped = PlayerPedId()
|
|
local c = GetEntityCoords(ped)
|
|
local h = GetEntityHeading(ped)
|
|
|
|
-- Raycast straight down from slightly above the player
|
|
local from = vector3(c.x, c.y, c.z + 1.0)
|
|
local to = vector3(c.x, c.y, c.z - 200.0)
|
|
|
|
-- Flags: 1=world, 16=objects, 256=vehicles; 511 is a good "hit most things"
|
|
local ray = StartShapeTestRay(from.x, from.y, from.z, to.x, to.y, to.z, 511, ped, 0)
|
|
local _, hit, hitCoords = GetShapeTestResult(ray)
|
|
|
|
local z = c.z
|
|
if hit == 1 and hitCoords then
|
|
z = hitCoords.z
|
|
end
|
|
|
|
local msg = ("Ground Coords (ray): 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)
|
|
|