что бы нпс спавнился и я мог ему ник дать над головой вот эта залупа нужна
local font = renderCreateFont("Arial", 9, 4)
local npcs = {}
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("npc", makeNpc)
sampRegisterChatCommand("npcdel", deleteNpcs)
while true do
wait(0)
for _, n in ipairs(npcs) do
if doesCharExist(n.h) then
local x, y, z = getCharCoordinates(n.h)
local sx, sy = convert3DCoordsToScreen(x, y, z + 1)
if sx then
renderFontDrawText(font, n.name, sx - renderGetFontDrawTextLength(font, n.name) / 2, sy, 0xFFFFFFFF)
end
end
end
end
end
function makeNpc(arg)
if not arg or arg == "" then return end
local x, y, z = getCharCoordinates(PLAYER_PED)
local a = getCharHeading(PLAYER_PED)
local h = createChar(0, 0, x + math.sin(math.rad(-a)) * 2, y + math.cos(math.rad(-a)) * 2, z, a + 180)
setCharProofs(h, true, true, true, true, true)
table.insert(npcs, {h = h, name = arg})
end
function deleteNpcs()
for _, n in ipairs(npcs) do
if doesCharExist(n.h) then markCharAsNoLongerNeeded(n.h) end
end
npcs = {}
end