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

Wysłany: 2018-11-20, 19:35


BoomEq







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

Piwa: 20

Respekt: 70

Witam, wyskakuje mi taki b??d:
attempt to index local 'rankSize' (a nil value)

w linijce 107:
local rankSizeX rankSize[1] / globalScale


Caly client:


-- && client-side && --


local somevalue 0

local maxDistance 40
local globalScale 5

local screenWscreenH guiGetScreenSize(  )

local armyranks = {}
local armyranksize = {}


local armyranksFullName = {
    "Private",
    "Private First Class",
    "Specialist",
    "Corporal",
    "Sergeant",
    "Staff Sergeant",
    "Sergeant First Class",
    "Master Sergeant",
    "First Sergeant",
    "Sergeant Major",
    "Command Sergeant Major",
    "Sergeant Major of the Army",
    "Second Lieutenant",
    "First Lieutenant",
    "Captain",
    "Major",
    "Lieutenant Colonel",
    "Colonel",
    "Brigadier General",
    "Major General",
    "Lieutenant General",
    "General",
    "General of the Army",
    "United States General"
}

local armyranksShortName = {
    "PVT",
    "PFC",
    "SPC",
    "CPL",
    "SGT",
    "SSG",
    "SFC",
    "MSG",
    "1SG",
    "SGM",
    "CSM",
    "SMA",
    "2LT",
    "1LT",
    "CPT",
    "MAJ",
    "LTC",
    "COL",
    "BG",
    "MG",
    "LTG",
    "GEN",
    "GOA",
    "USG"


}

for 124do
armyranks[i] = dxCreateTexturei..".png""argb"false"wrap" )
 local img fileOpen(i..".png")
 local pixels fileRead(imgfileGetSize(img))
 local wdxGetPixelsSize(pixels)
 armyranksize[i] = {w,h}
 fileClose(img)
end

function removeHexColor(text)
    text string.gsub(text,"#%x%x%x%x%x%x""")
    return text
end

addEventHandler("onClientRender",root,function ()
    somevalue somevalue 0.05
for keyvalue in ipairs(getElementsByType("player")) do
    if value ~= localPlayer then
        if getElementData(value,"ranga"then
            local armyrank getElementData(value,"ranga")

            local cxcycz getCameraMatrix()
            local xygetPedBonePositionvalue)
            local xsysds getScreenFromWorldPositionxy0.8 )

            if xs and ys and ds and ds <= maxDistance then
            if isLineOfSightClearxyzcxcycztruefalsefalse then
                local rankSize armyranksize[armyrank]
                local rankSizeX rankSize[1] / globalScale
                local rankSizeY rankSize[2] / globalScale
                local scaleXscaleY = (rankSizeX/1280)*screenW, (rankSizeY/1024)*screenH

                local offsetByDistance = {scaleX/(ds/8),scaleY/(ds/8)}


                dxDrawImagexs-(offsetByDistance[1]/2), ys-(offsetByDistance[2]/2), offsetByDistance[1], offsetByDistance[2], armyranks[armyrank],,0,0,tocolor(255,255,255,255))        
end
end


if getElementData(value,"data:specialtext"then
                    for keytext in ipairs(getElementData(value,"data:specialtext")) do
                                        local xygetPedBonePositionvalue)
            local xsysds getScreenFromWorldPositionxy1.0+(key/8) )
            if xs and ys and ds and ds <= maxDistance then
            if isLineOfSightClearxyzcxcycztruefalsefalse then
                local scale = ((0.5/(ds/8))/1280)*screenW
                local scale2 = ((0.5/(ds/8))/1024)*screenH
                    local wid dxGetTextWidthtextscale"bankgothic" )
                    local hei dxGetFontHeightscale"bankgothic" )
                    local r,g,getColorFromStringstring.sub(text,1,7) )

dxDrawTextremoveHexColor(string.gsub(text,"BORDER","")),     (xs-(wid))-1ys-(hei), xs+wid,ys+heitocolor(0,0,0,255),    scale,scale2"bankgothic","center","center",false,false,false,false)
dxDrawTextremoveHexColor(string.gsub(text,"BORDER","")),     (xs-(wid))+1ys-(hei), xs+wid,ys+heitocolor(0,0,0,255),    scale,scale2"bankgothic","center","center",false,false,false,false)
dxDrawTextremoveHexColor(string.gsub(text,"BORDER","")),     (xs-(wid)), (ys-(hei))-1xs+wid,ys+heitocolor(0,0,0,255),    scale,scale2"bankgothic","center","center",false,false,false,false)
dxDrawTextremoveHexColor(string.gsub(text,"BORDER","")),     (xs-(wid)), (ys-(hei))+1xs+wid,ys+heitocolor(0,0,0,255),    scale,scale2"bankgothic","center","center",false,false,false,false)


                    dxDrawTextstring.gsub(text,"BORDER",""),     xs-(wid), ys-(hei), xs+wid,ys+heitocolor(r,g,b,255),    scale,scale2"bankgothic","center","center",false,false,false,true)


                    end
            end
        end
        end

end
end
end
end)



addEventHandler("onClientRender",root,function ()
    if getElementData(localPlayer,"ranga"then
        local armyrank getElementData(localPlayer,"ranga")
        --dxDrawImage((1049/1280)*screenW, ((811/1024)*screenH)+2, (200/1280)*screenW, (184/1024)*screenHarmyranks[armyrank], 000tocolor(0,0,0255), false)
        
        dxDrawImage((1049/1280)*screenW, (811/1024)*screenH, (200/1280)*screenW, (184/1024)*screenHarmyranks[armyrank], 000tocolor(255255255255), false)
         dxDrawText(armyranksFullName[armyrank], (1049/1280)*screenW, ((791/1024)*screenH)+2, (1249/1280)*screenW, (807/1024)*screenHtocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
       
        dxDrawText(armyranksFullName[armyrank], (1049/1280)*screenW, (791/1024)*screenH, (1249/1280)*screenW, (807/1024)*screenHtocolor(255255255255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
        if getElementData(localPlayer,"data:specialtext"then
        for keyvalue in ipairs(getElementData(localPlayer,"data:specialtext")) do
            local text value
        local offset = (20/1024)*screenH
        if string.find(text,"BORDER"then
text string.gsub(text,"BORDER","")
--dxDrawText(removeHexColor(text), ((1065/1280)*screenW)-1, (((805/1024)*screenH)-(offset*key)), (1230/1280)*screenW, ((791/1024)*screenH)-(offset*key), tocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
  --      dxDrawText(removeHexColor(text), ((1065/1280)*screenW)+1, ((805/1024)*screenH)-(offset*key), (1230/1280)*screenW, ((791/1024)*screenH)-(offset*key), tocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
    --    dxDrawText(removeHexColor(text), ((1065/1280)*screenW), (((805/1024)*screenH)-(offset*key))-1, (1230/1280)*screenW, ((791/1024)*screenH)-(offset*key), tocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
      --  dxDrawText(removeHexColor(text), ((1065/1280)*screenW), (((805/1024)*screenH)-(offset*key))+1, (1230/1280)*screenW, ((791/1024)*screenH)-(offset*key), tocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)
end
    dxDrawText(removeHexColor(text), (1065/1280)*screenW, (((805/1024)*screenH)-(offset*key))+1, (1230/1280)*screenW, (((791/1024)*screenH)-(offset*key))+1tocolor(0,0,0255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsetruefalse)
        
       dxDrawText(text, (1065/1280)*screenW, ((805/1024)*screenH)-(offset*key), (1230/1280)*screenW, ((791/1024)*screenH)-(offset*key), tocolor(255255255255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsetruefalse)
        


            end
        end
    end
    end)





Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-21, 08:28


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Brak tabelki rankSize.
Spr?buj:

local?rankSizeX?=?rankSize?/?globalScale


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-21, 16:01


BoomEq







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

Piwa: 20

Respekt: 70

Teraz taki blad wyskakuje a wszystko raczej jest dobrze..
 Bad argument 'dxDrawText' [Expected string at argument 1got nil



Cala linijka
dxDrawText(armyranksFullName[armyrank], (1049/1280)*screenW, (791/1024)*screenH, (1249/1280)*screenW, (807/1024)*screenHtocolor(255255255255), (0.60/1280)*screenW, (0.60/1024)*screenH"bankgothic""center""center"falsefalsefalsefalsefalse)


[ Dodano: 2018-11-21, 16:38 ]
Poprawilem ale teraz takie cos:
bad argument #1 to 'ipairs' (table xpected, got string)

w tej linijce:
         for keyvalue in ipairs(getElementData(localPlayer,"data:specialtext")) do 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-21, 16:41


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Znajd? w swoich skryptach miejsce, gdzie ustawiasz elementDat? 'data:specialtext'.
Aktualnie nie jest to tabela, co powoduje b??dy jak powy?ej.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-21, 16:42


BoomEq







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

Piwa: 20

Respekt: 70

Wilq, Ustawilem sobie elementdate na serial i co mam w tym zmienic?

[ Dodano: 2018-11-21, 16:43 ]
                     if getPlayerSerial(plr) == "serialekmoj" then
                    setElementData(plr,"data:specialtext","Elite") 
                    end 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-21, 16:47


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Albo znajdziesz miejsce gdzie ustawiasz elementDat? jako tabel?,
albo usuniesz
for keyvalue in ipairs(getElementData(localPlayer,"data:specialtext")) do

i odpowiednio zmodyfikujesz reszt? kodu, aby nie korzysta? z elementDaty.

Postaw piwo autorowi tego posta
 

 
Tagi: rangi
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Rangi 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