Siemka
Bo mam ma?y problem, ot?? posiadam hud i gdy wchodz? na serwer to gdy ju? wejde na niego ale nawet si? jeszcze nie zaloguje to wida? hud z pieni?dzmi itd.
I st?d pytanie, czy da sie zrobi? ?e dopiero po zalogowaniu by sie pokazywa?, i je?li tak to jak?
function findPlayer(plr,cel)
local target=nil
if (tonumber(cel) ~= nil) then
target=getElementByID("p"..cel)
else -- podano fragment nicku
for _,thePlayer in ipairs(getElementsByType("player")) do
if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), cel:lower(), 1, true) then
if (target) then
outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter.", plr)
return nil
end
target=thePlayer
end
end
end
return target
end
local function findFreeValue(tablica_id)
table.sort(tablica_id)
local wolne_id=0
for i,v in ipairs(tablica_id) do
if (v==wolne_id) then wolne_id=wolne_id+1 end
if (v>wolne_id) then return wolne_id end
end
return wolne_id
end
function assignPlayerID(plr)
local gracze=getElementsByType("player")
local tablica_id = {}
for i,v in ipairs(gracze) do
local lid=getElementData(v, "id")
if (lid) then
table.insert(tablica_id, tonumber(lid))
end
end
local free_id=findFreeValue(tablica_id)
setElementData(plr,"id", free_id)
setElementID(plr, "p" .. free_id)
return free_id
end
function getPlayerID(plr)
if not plr then return "" end
local id=getElementData(plr,"id")
if (id) then
return id
else
return assignPlayerID(plr)
end
end
addEventHandler ("onPlayerJoin", getRootElement(), function()
assignPlayerID(source)
end)
C-Side
local fontm = dxCreateFont("font.otf", 16)
--SKALOWANIE GUI--
local screenW, screenH = guiGetScreenSize()
local w, h = (screenW/1920), (screenH/1080)
local ranga = "brak"
--------------------------------------------
addEventHandler("onClientRender", root, function()
setPlayerHudComponentVisible("all", false)
local hp = math.floor(getElementHealth(localPlayer))
local nickname = getPlayerName(localPlayer)
local money = getPlayerMoney(localPlayer)
dxDrawImage(1600*w, 50*h, 301*w, 130*h, "images/bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText(nickname.."[#00fff2"..getElementData(localPlayer, "id").."#FFFFFF]", 3500*w, 60*h, 0, 0, tocolor(255, 255, 255, 255), 1, fontm, 'center', 'top', false, false, false, true)
dxDrawText(hp.."%", 1830*w, 103*h, 0, 0, tocolor(255, 255, 255, 255), 0.8, fontm, 'left', 'top', false, false, false, true)
dxDrawText(money.."$", 1660*w, 103*h, 0, 0, tocolor(255, 255, 255, 255), 0.8, fontm, 'left', 'top', false, false, false, true)
if getElementData(localPlayer, "rank") == 1 then
ranga = "#FFFFFFGracz"
end
if getElementData(localPlayer, "rank") == 2 then
ranga = "#40ff23Moderator"
end
dxDrawText(ranga, 3490*w, 150*h, 0, 0, tocolor(255, 255, 255, 255), 0.8, fontm, 'center', 'top', false, false, false, true)
end)
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