Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-06-28, 12:24


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70

Witam serdecznie,
Gdy w??czam skrypt ( iyw_gui ) wyskakuje mi b??d w DB3 :
Kod:

iyw_gui\main_c.lua:56: attempt to perform arithmetic on field '?' (a nil value )


Teraz ca?a zawarto?? main_c.lua :
Kod:



local screenSize = Vector2(guiGetScreenSize())
local timer = false

addEventHandler("onClientMinimize", root, function()
localPlayer:setData("player:minimalized", getTickCount())
localPlayer:setData("player:tick", getTickCount())
timer = Timer(function() localPlayer:setData("player:tick", getTickCount()) end, 1000, 0)
end)

addEventHandler("onClientRestore", root, function()
localPlayer:setData("player:minimalized", false)
if timer and timer.valid then timer:destroy() end
end)

addEventHandler("onClientRender", root, function()
if not isPlayerMapVisible() and not localPlayer:getData("player:hud_visible") then
local position = {getElementPosition(localPlayer)}
local city = getZoneName(position[1], position[2], position[3], true)
local street = getZoneName(position[1], position[2], position[3], false)
if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(true) end

if city == "Unknown" then street = "" end
if city ~= street then street = " "..street.."\n"..city else street = " "..street end
if isPlayerHudComponentVisible("radar") and localPlayer.interior == 0 and localPlayer.dimension == 0 then
dxDrawText(street, (260/1280*screenSize.x)+1, (660/720*screenSize.y)+1, (399/1280*screenSize.x)+1, (670/720*screenSize.y)+1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "left", "center")
dxDrawText(street, 260/1280*screenSize.x, 660/720*screenSize.y, 399/1280*screenSize.x, 670/720*screenSize.y, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center")
end
end
end)

local function checkLevel(player)
distance = 0
if player:getData("player:level") then distance = 0.62 else distance = 0.56 end
return distance
end

addEventHandler("onClientRender", root, function()
for k,v in pairs(Element.getAllByType("player")) do
if localPlayer.interior == v.interior and localPlayer.dimension == v.dimension then
local camera = {getCameraMatrix()}
local bone = {v:getBonePosition(8)}
local distance = getDistanceBetweenPoints3D(camera[1], camera[2], camera[3], bone[1], bone[2], bone[3])
if localPlayer:getData("player:hud_visible") then return false end

if distance <= 30 and v.alpha >= 230 then
local coords = {getScreenFromWorldPosition(bone[1], bone[2], bone[3]+checkLevel(v))}
if coords[1] and coords[2] then
local minimalized = ""
local minimal = v:getData("player:minimalized")
if minimal then
local tick = v:getData("player:tick")
if tick then
local tick = tick - minimal
local sekundy=math.floor(tick/1000) or 0
local godziny = string.format("%02.f", math.floor(sekundy/3600));
local minuty = string.format("%02.f", math.floor(sekundy/60 - (godziny*60)));
local secs = string.format("%02.f", math.floor(sekundy - godziny*3600 - minuty *60));
minimalized = "poza mta od: "..godziny.."h "..minuty.."m "..secs.."s"
end
end

local data = (getElementData(v, "player:level") and v:getData("player:duty"))
rank = ranks[getElementData(v, "player:level")] or ""
visualrank = getElementData(v, "player:visualrank")
visualid = getElementData(v, "player:visualid") or "#FFFFFF"
if getElementData(v, "chat_typing") then chat = "#9F9F9F(...)#ffffff" else chat = "" end
--if getElementData(v, "p:title") then tytul = "" else tytul = "" end
if getElementData(v, "player:muted") then prefix = "#8060FF(MUTE)" else prefix = "" end
if getElementData(v, "player:duty") == "SAPD" then dutyf = "#0000CDSan Andreas Police Department" elseif v:getData("player:duty") == "SAMA" then dutyf = "#00A0FFSan Andreas Medical Assistance" elseif v:getData("player:duty") == "SAFD" then dutyf = "#FF0000San Andreas Fire Department" elseif v:getData("player:duty") == "TAXI" then dutyf = "#FFFF00Transport San Andreas" elseif v:getData("player:duty") == "tuner-lv" then dutyf = "Tuner Las Venturas" end
statue = getElementData(v, "p:title") or ""

if data and not visualrank then
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, tocolor(0, 0, 0, 255), 0.7-distance/45, "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
elseif data and visualrank then
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualid:gsub("#%x%x%x%x%x%x","")..""..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", ""):gsub("#%x%x%x%x%x%x","").." "..chat.."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, tocolor(0, 0, 0, 255), 0.7-distance/45, utils.nametagFont or "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..visualrank.."#FFFFFF\n["..getColorWhereRank(v)..""..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
elseif v:getData("player:level") and not visualrank then
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, tocolor(0, 0, 0, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
elseif v:getData("player:level") and visualrank then
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, 0.7-distance/45, "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n"..visualrank.."#FFFFFF\n["..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
elseif v:getData("player:duty") then
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n#FFFFFF["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
else
--dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1, coords[2]+1, coords[1]+1, coords[2]+1, 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
dxDrawText(minimalized.."\n\n"..statue.."\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name, "#%x%x%x%x%x%x", "").." "..chat.."\n"..prefix, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), 1.00-distance/45, "default-bold", "center", "center", false, true, false, true)
end
end
end
end
end
end)

function checkPlayerChatTyping()
if isChatBoxInputActive() then
if getElementData(localPlayer, "chat_typing")==false then
setElementData(localPlayer, "chat_typing", true)
end
else
if getElementData(localPlayer, "chat_typing")==true then
setElementData(localPlayer, "chat_typing", false)
end
end
end
setTimer(checkPlayerChatTyping, 100, 0)


Je?eli kto? mi pomo?e to b?d? wdzi?czny.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-28, 12:28


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3060 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

Daj prosz? kod w tagach [lua]kod[./lua] bez kropki tam. I daj linijk? 56.

Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔

Aktualny projekt: BRAK
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-28, 12:31


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70

local coords = {getScreenFromWorldPosition(bone[1], bone[2], bone[3]+checkLevel(v))}


[ Dodano: 2018-06-28, 12:40 ]
 

local screenSize Vector2(guiGetScreenSize())
local timer false

addEventHandler("onClientMinimize"root, function()
    localPlayer:setData("player:minimalized"getTickCount())
    localPlayer:setData("player:tick"getTickCount())
    timer Timer(function() localPlayer:setData("player:tick"getTickCount()) end10000)
end)

addEventHandler("onClientRestore"root, function()
    localPlayer:setData("player:minimalized"false)
    if timer and timer.valid then timer:destroy() end
end)

addEventHandler("onClientRender"root, function()
    if not isPlayerMapVisible() and not localPlayer:getData("player:hud_visible"then
        local position = {getElementPosition(localPlayer)}
        local city getZoneName(position[1], position[2], position[3], true)
        local street getZoneName(position[1], position[2], position[3], false)
        if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(trueend
        
        if city == "Unknown" then street "" end
        if city ~= street then street "   "..street.."\n"..city else street "   "..street end
        if isPlayerHudComponentVisible("radar") and localPlayer.interior == and localPlayer.dimension == 0 then
            dxDrawText(street, (260/1280*screenSize.x)+1, (660/720*screenSize.y)+1, (399/1280*screenSize.x)+1, (670/720*screenSize.y)+1tocolor(000255), 1.00"default-bold""left""center")
            dxDrawText(street260/1280*screenSize.x660/720*screenSize.y399/1280*screenSize.x670/720*screenSize.ytocolor(255255255255), 1.00"default-bold""left""center")
        end
    end
end)

local function checkLevel(player)
    distance 0
    if player:getData("player:level"then distance 0.62 else distance 0.56 end
    return distance
end

addEventHandler("onClientRender"root, function()
    for k,v in pairs(Element.getAllByType("player")) do
        if localPlayer.interior == v.interior and localPlayer.dimension == v.dimension then
            local camera = {getCameraMatrix()}
            local bone = {v:getBonePosition(8)}
            local distance getDistanceBetweenPoints3D(camera[1], camera[2], camera[3], bone[1], bone[2], bone[3])
            if localPlayer:getData("player:hud_visible"then return false end
            
            if distance <= 30 and v.alpha >= 230 then
                local coords = {getScreenFromWorldPosition(bone[1], bone[2], bone[3]+checkLevel(v))}
                if coords[1] and coords[2then
                    local minimalized ""
                    local minimal v:getData("player:minimalized")
                    if minimal then 
                        local tick v:getData("player:tick")
                        if tick then
                            local tick tick minimal
                            local sekundy=math.floor(tick/1000) or 0
                            local godziny string.format("%02.f"math.floor(sekundy/3600));
                            local minuty string.format("%02.f"math.floor(sekundy/60 - (godziny*60)));
                            local secs string.format("%02.f"math.floor(sekundy godziny*3600 minuty *60));
                            minimalized "poza mta od: "..godziny.."h "..minuty.."m "..secs.."s" 
                        end
                    end
                    
                    local data = (getElementData(v"player:level") and v:getData("player:duty"))
                    rank ranks[getElementData(v"player:level")] or ""
                    visualrank getElementData(v"player:visualrank")
                    visualid getElementData(v"player:visualid") or "#FFFFFF"
                    if getElementData(v"chat_typing"then chat "#9F9F9F(...)#ffffff" else chat "" end
                    --if getElementData(v"p:title"then tytul "" else tytul "" end
                    if getElementData(v"player:muted"then prefix "#8060FF(MUTE)" else prefix "" end
                    if getElementData(v"player:duty") == "SAPD" then dutyf "#0000CDSan Andreas Police Department" elseif v:getData("player:duty") == "SAMA" then dutyf "#00A0FFSan Andreas Medical Assistance" elseif v:getData("player:duty") == "SAFD" then dutyf "#FF0000San Andreas Fire Department" elseif v:getData("player:duty") == "TAXI" then dutyf "#FFFF00Transport San Andreas" elseif v:getData("player:duty") == "tuner-lv" then dutyf "Tuner Las Venturas" end
                    statue getElementData(v"p:title") or ""

                    if data and not visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 0.7-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif data and visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualid:gsub("#%x%x%x%x%x%x","")..""..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x"""):gsub("#%x%x%x%x%x%x","").." "..chat.."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 0.7-distance/45utils.nametagFont or "default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..visualrank.."#FFFFFF\n["..getColorWhereRank(v)..""..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)    
                    elseif v:getData("player:level") and not visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif v:getData("player:level") and visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+10.7-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..visualrank.."#FFFFFF\n["..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif v:getData("player:duty"then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+11.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n#FFFFFF["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    else
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+11.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    end
                end
            end
        end
    end
end)

function checkPlayerChatTyping()
    if isChatBoxInputActive() then
        if getElementData(localPlayer"chat_typing")==false then
            setElementData(localPlayer"chat_typing"true)
        end
    else
        if getElementData(localPlayer"chat_typing")==true then
            setElementData(localPlayer"chat_typing"false)
        end
    end
end
setTimer(checkPlayerChatTyping1000


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-06-28, 20:33


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Ju? kto? pisa? ten temat.


local coords = {getScreenFromWorldPosition(bone[1], bone[2], bone[3])}
coords[2] = coords[2] + checkLevel(v)


P.S b?dziesz musia? podwy?szy? nick bo troch? opdanie i wtedy trzeba doda? + 1 do coords[2].

czyli powinno by? tak


local screenSize Vector2(guiGetScreenSize())
local timer false

addEventHandler("onClientMinimize"root, function()
    localPlayer:setData("player:minimalized"getTickCount())
    localPlayer:setData("player:tick"getTickCount())
    timer Timer(function() localPlayer:setData("player:tick"getTickCount()) end10000)
end)

addEventHandler("onClientRestore"root, function()
    localPlayer:setData("player:minimalized"false)
    if timer and timer.valid then timer:destroy() end
end)

addEventHandler("onClientRender"root, function()
    if not isPlayerMapVisible() and not localPlayer:getData("player:hud_visible"then
        local position = {getElementPosition(localPlayer)}
        local city getZoneName(position[1], position[2], position[3], true)
        local street getZoneName(position[1], position[2], position[3], false)
        if dxSetAspectRatioAdjustmentEnabled then dxSetAspectRatioAdjustmentEnabled(trueend
        
        if city == "Unknown" then street "" end
        if city ~= street then street "   "..street.."\n"..city else street "   "..street end
        if isPlayerHudComponentVisible("radar") and localPlayer.interior == and localPlayer.dimension == 0 then
            dxDrawText(street, (260/1280*screenSize.x)+1, (660/720*screenSize.y)+1, (399/1280*screenSize.x)+1, (670/720*screenSize.y)+1tocolor(000255), 1.00"default-bold""left""center")
            dxDrawText(street260/1280*screenSize.x660/720*screenSize.y399/1280*screenSize.x670/720*screenSize.ytocolor(255255255255), 1.00"default-bold""left""center")
        end
    end
end)

local function checkLevel(player)
    distance 0
    if player:getData("player:level"then distance 0.62 else distance 0.56 end
    return distance
end

addEventHandler("onClientRender"root, function()
    for k,v in pairs(Element.getAllByType("player")) do
        if localPlayer.interior == v.interior and localPlayer.dimension == v.dimension then
            local camera = {getCameraMatrix()}
            local bone = {v:getBonePosition(8)}
            local distance getDistanceBetweenPoints3D(camera[1], camera[2], camera[3], bone[1], bone[2], bone[3])
            if localPlayer:getData("player:hud_visible"then return false end
            
            if distance <= 30 and v.alpha >= 230 then
                local coords = {getScreenFromWorldPosition(bone[1], bone[2], bone[3])}
coords[2] = coords[2] + checkLevel(v)
                if coords[1] and coords[2then
                    local minimalized ""
                    local minimal v:getData("player:minimalized")
                    if minimal then 
                        local tick v:getData("player:tick")
                        if tick then
                            local tick tick minimal
                            local sekundy=math.floor(tick/1000) or 0
                            local godziny string.format("%02.f"math.floor(sekundy/3600));
                            local minuty string.format("%02.f"math.floor(sekundy/60 - (godziny*60)));
                            local secs string.format("%02.f"math.floor(sekundy godziny*3600 minuty *60));
                            minimalized "poza mta od: "..godziny.."h "..minuty.."m "..secs.."s" 
                        end
                    end
                    
                    local data = (getElementData(v"player:level") and v:getData("player:duty"))
                    rank ranks[getElementData(v"player:level")] or ""
                    visualrank getElementData(v"player:visualrank")
                    visualid getElementData(v"player:visualid") or "#FFFFFF"
                    if getElementData(v"chat_typing"then chat "#9F9F9F(...)#ffffff" else chat "" end
                    --if getElementData(v"p:title"then tytul "" else tytul "" end
                    if getElementData(v"player:muted"then prefix "#8060FF(MUTE)" else prefix "" end
                    if getElementData(v"player:duty") == "SAPD" then dutyf "#0000CDSan Andreas Police Department" elseif v:getData("player:duty") == "SAMA" then dutyf "#00A0FFSan Andreas Medical Assistance" elseif v:getData("player:duty") == "SAFD" then dutyf "#FF0000San Andreas Fire Department" elseif v:getData("player:duty") == "TAXI" then dutyf "#FFFF00Transport San Andreas" elseif v:getData("player:duty") == "tuner-lv" then dutyf "Tuner Las Venturas" end
                    statue getElementData(v"p:title") or ""

                    if data and not visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 0.7-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif data and visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n"..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..getColorWhereRank(v):gsub("#%x%x%x%x%x%x","")..""..visualid:gsub("#%x%x%x%x%x%x","")..""..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x"""):gsub("#%x%x%x%x%x%x","").." "..chat.."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 0.7-distance/45utils.nametagFont or "default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n"..getColorWhereRank(v)..""..visualrank.."#FFFFFF\n["..getColorWhereRank(v)..""..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)    
                    elseif v:getData("player:level") and not visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..rank.."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+1tocolor(000255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..getColorWhereRank(v)..""..rank.."#FFFFFF\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif v:getData("player:level") and visualrank then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..visualrank:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+10.7-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..visualrank.."#FFFFFF\n["..visualid..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    elseif v:getData("player:duty"then
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n"..dutyf:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+11.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n"..dutyf.."\n#FFFFFF["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    else
                        --dxDrawText(minimalized.."\n\n"..statue:gsub("#%x%x%x%x%x%x","").."\n["..(v:getData("id") or 0).."] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat:gsub("#%x%x%x%x%x%x","").."\n"..prefix:gsub("#%x%x%x%x%x%x",""), coords[1]+1coords[2]+1coords[1]+1coords[2]+11.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                        dxDrawText(minimalized.."\n\n"..statue.."\n["..getColorWhereRank(v)..""..(v:getData("id") or 0).."#FFFFFF] "..string.gsub(v.name"#%x%x%x%x%x%x""").." "..chat.."\n"..prefixcoords[1], coords[2], coords[1], coords[2], tocolor(255255255255), 1.00-distance/45"default-bold""center""center"falsetruefalsetrue)
                    end
                end
            end
        end
    end
end)

function checkPlayerChatTyping()
    if isChatBoxInputActive() then
        if getElementData(localPlayer"chat_typing")==false then
            setElementData(localPlayer"chat_typing"true)
        end
    else
        if getElementData(localPlayer"chat_typing")==true then
            setElementData(localPlayer"chat_typing"false)
        end
    end
end
setTimer(checkPlayerChatTyping1000


My?l?, ?e b?dzie dzia?a? bo sam stosowa?em tak? metod?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
BoomEq
Wysłany: 2018-06-28, 20:59


BoomEq







Wiek: 35
Na forum: 3522 dni
Posty: 101
Nick w MP: BoomEqqq

Piwa: 20

Respekt: 70

DylemaT929, Danke

Postaw piwo autorowi tego posta
 

 
Tagi: nametagi
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Nametagi Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku