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

Wysłany: 2020-06-29, 15:22


dawfig







Wiek: 28
Na forum: 2883 dni
Posty: 27
Nick w MP: dawfex

Piwa: 505

Respekt: 45,3

Mam taki b??d jak go naprawi? ?


[20-06-29 15:20] ERROR: [prace]/dmta_autobusy/s_core.lua:87: attempt to index field '?' (a nil value)

Podpis
:)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-29, 15:30


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Z?e odniesienie do tabeli, brak element?w w tabeli lub b??dne u?ycie indeksowania w celu znalezienia elementu (z?a zmienna itd).

Bez kodu nic nie zrobimy, mo?na strzela? co do problemu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-29, 16:02


dawfig







Wiek: 28
Na forum: 2883 dni
Posty: 27
Nick w MP: dawfex

Piwa: 505

Respekt: 45,3

"Wilq" napisał/a:

Z?e odniesienie do tabeli, brak element?w w tabeli lub b??dne u?ycie indeksowania w celu znalezienia elementu (z?a zmienna itd).

Bez kodu nic nie zrobimy, mo?na strzela? co do problemu.



Kod:

function createObjectF(player)
if objects[player] and isElement(objects[player]) then
destroyElement(objects[player])
objects[player] = nil
end
setPedAnimation(player, "CARRY", "crry_prtial", 4.1, true, true, true)
objects[player] = createObject(1271, 0, 0, 0)
setObjectScale(objects[player], 0.8)
attachElements(objects[player], player, -0.087, 0.5, 0.55)
setElementCollisionsEnabled(objects[player], false)
end
addEvent("dmta_magazynier:createObject", true)
addEventHandler("dmta_magazynier:createObject", getRootElement(), createObjectF)

function destroyObjectF(player)
if objects[player] and isElement(objects[player]) then
destroyElement(objects[player])
objects[player] = nil
end
setPedAnimation(player, false)
end
addEvent("dmta_magazynier:destroyObject", true)
addEventHandler("dmta_magazynier:destroyObject", getRootElement(), destroyObjectF)

function givePayout(player)
local r = math.random(0500, 0600)
local money = getPlayerMoney(player)
local uid = getElementData(player, "player:sid")
if getElementData(client, "player:gold") then
r = r+(r*0.15)
elseif getElementData(client, "player:premium") then
r = r+(r*0.05)
end
r = math.floor(r)
if money+r <= 99999999 then
givePlayerMoney(player, r)
exports["dmta_notifications"]:sendNotification(player, "Otrzyma?e? do portfela "..r.."$"..(getElementData(client, "player:gold") and "(+2% za konto premium+)" or getElementData(client, "player:premium") and "(+1% za konto premium)" or ""))
else
exports["dmta_xdb"]:wykonaj("UPDATE pystories_users SET bank_money=bank_money+? WHERE id=? LIMIT 1", r, uid)
exports["dmta_notifications"]:sendNotification(player, "Otrzyma?e? do banku "..r.."$"..(getElementData(client, "player:gold") and "(+2% za konto premium+)" or getElementData(client, "player:premium") and "(+1% za konto premium)" or "")..", gdy? tw?j portfel jest pe?en(max. 99,999,999$)")
end
local r2 = math.random(1, 4)
if r2 == 1 then
local r3 = math.random(1, 3)
exports["dmta_notifications"]:sendNotification(player, "Tym razem uda?o ci si? zdoby? r?wnie? "..r3.." reputacji")
local rp = getElementData(player, "player:srp")
setElementData(player, "player:srp", rp+r3)
end
if uid then
local q = exports["dmta_xdb"]:wykonaj("SELECT id FROM magazynier_ranking WHERE id=? LIMIT 1", uid)
if q and #q > 0 then
exports["dmta_xdb"]:wykonaj("UPDATE magazynier_ranking SET count=count+1 WHERE id=?", uid)
else
exports["dmta_xdb"]:wykonaj("INSERT INTO magazynier_ranking SET id=?", uid)
end
end
end
addEvent("dmta_magazynier:givePayout", true)
addEventHandler("dmta_magazynier:givePayout", getRootElement(), givePayout)

addEventHandler("onPlayerQuit", getRootElement(), function()
if objects[source] and isElement(objects[source]) then
destroyObjectF(source)
end
end)

local ranking_text = createElement("text")
setElementPosition(ranking_text, -1834.25, 111.90, 15.12+1.5)

function refreshRanking()
local ranking = {}
local q_ranking = exports["dmta_xdb"]:wykonaj("SELECT id, count FROM magazynier_ranking ORDER BY count DESC LIMIT 10")
for i, v in ipairs(q_ranking) do
local q = exports["dmta_xdb"]:wykonaj("SELECT login, login2 FROM pystories_users WHERE id=? LIMIT 1", v.id)
ranking[#ranking+1] = {
name = (q[1].login2 or q[1].login or "---"),
count = v.count,
}
end
local text = "*Od?wie?a si? co 5 min*\nRanking magazyniera[TOP 10]:\n"
for i, v in ipairs(ranking) do
text = text..i..": "..v.name.." - "..v.count.."\n"
end
setElementData(ranking_text, "name", text)
end
refreshRanking()
setTimer(function()
refreshRanking()
end, 300000, 0)


Podpis
:)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-29, 16:18


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

I kt?ra to 87 linijka?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-29, 21:16


Irvs







Wiek: 30
Na forum: 2680 dni
Posty: 48

Piwa: 3

Respekt: 50

Tutaj masz kod na co? takiego jak potrzebujesz.


str=" "
local tekst=createElement("text")
setElementData(tekst,"scale",1)
setElementPosition(tekst,-1834.25111.9015.12+1.5)

function wyniki()

   local q=exports["DB"]:dbGet("select * from magazynier_ranking ORDER BY count DESC LIMIT 10")
   
    str="Ranking magazyniera[TOP 10]:"
    for i,v in ipairs(q) do
                    str=""..str.."\n"..i..". "..v["id"].."  - "..string.format(v["count"]).." PKT"

    end
    setElementData(tekst"name"str)
end
setTimer(wyniki3000000)
wyniki()


Reszt? chyba ju? rozkminisz np jak zamieni? id na nick.

Postaw piwo autorowi tego posta
 

 
Tagi: wyświetlaniu :: rankingu :: top10
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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