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

Wysłany: 2023-03-20, 20:49


Mateuszkropkaaa







Wiek: 29
Na forum: 3008 dni
Posty: 9
Nick w MP: Mateuszkropkaaa

Piwa: 47

Respekt: 50

Wywala mi b??d przy wej?ciu w blipa od wyp?at: s_money_from_job.lua:72: attempt to perform arithmetic on local 'money' (a nil value)

Kod

Kod:


local pension = { --za 1 minute
["SAPD"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},
["SAFD"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},
["SARA"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},

}

local mnoznik = 1

local markersFactionPayment={
{-2636.63, -9.21, 6.13},

}

for i,v in ipairs(markersFactionPayment) do
local marker=createMarker(v[1], v[2], v[3]-1, "cylinder", 1.2, 255, 255, 255)
setElementData(marker,'marker:text','#00C645WYPŁATA')
setElementData(marker,'marker:downtext','Tutaj odbierzesz wyp?‚at?™ z frakcji')
setElementData(marker,'marker:icon','job')
setElementInterior(marker, v[4] or 0)
setElementDimension(marker, v[5] or 0)
end

addEventHandler("onMarkerHit", resourceRoot, function(el,md)
if not md or getElementType(el) ~= "player" then return end
local sid=getElementData(el,"player:sid")
if not sid then return end
local result=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_factions WHERE uid=? LIMIT 1;", sid)
if result and #result > 0 then
local resulted=exports["nrpg_db"]:dbGet("SELECT * FROM pystories_factions WHERE faction=?", faction)
local sid = getElementData(el,"player:sid")
if #result > 0 then
if pension[result[1].faction] then
if getElementData(el,"player:workinjob") and getElementData(el,"player:workinjob") >= 1 then
local money = pension[result[1].faction][result[1].rank]
local money = money * getElementData(el,"player:workinjob")
local money = math.floor(money*mnoznik)
exports.nrpg_interface:showPlayerNotification(el, "Otrzymujesz "..money.." PLN (przepracowane: "..getElementData(el,"player:workinjob").." minut),\npieni?…dze trafi?‚y do bankomatu.", "success")
exports["DB2"]:zapytanie("UPDATE pystories_users SET bank_money=bank_money+"..(tonumber(money) or 0).." WHERE id="..tonumber(sid).." LIMIT 1")
setElementData(el,"player:workinjob",0)
else
exports.nrpg_interface:showPlayerNotification(el, "Nie masz nic do odebrania!", "error")
end
end
end
end
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-21, 19:15


Pawelek







Wiek: 22
Na forum: 3627 dni
Posty: 18

Piwa: 28

Respekt: 60

Wydaje mi si?, ?e te trzy zmienne o takiej samej nazwie koliduj? ze sob?.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-22, 19:17


!hejcob

Twórca Botów Discord.






Wiek: 25
Na forum: 1511 dni
Posty: 27
Nick w MP: Hejcob.gg

Piwa: 90

Respekt: 55,3

Mateuszkropkaaa, tutaj poprawiony skrypt powinien dzia?a?

local pension = { -- za 1 minut?
["SAPD"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},
["SAFD"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},
["SARA"] = {
[1] = 800,
[2] = 850,
[3] = 900,
[4] = 950,
[5] = 1000,
[6] = 1050,
[7] = 1100,
[8] = 1150,
[9] = 1200,
[10] = 1250,
[11] = 1500,
},
}

local mnoznik = 1

local markersFactionPayment = {
{-2636.63, -9.21, 6.13},
}

for i, v in ipairs(markersFactionPayment) do
local marker = createMarker(v[1], v[2], v[3] - 1, "cylinder", 1.2, 255, 255, 255)
setElementData(marker, 'marker:text', '#00C645WYP?ATA')
setElementData(marker, 'marker:downtext', 'Tutaj odbierzesz wyp?at? z frakcji')
setElementData(marker, 'marker:icon', 'job')
setElementInterior(marker, v[4] or 0)
setElementDimension(marker, v[5] or 0)
end

addEventHandler("onMarkerHit", resourceRoot, function(el, md)
if not md or getElementType(el) ~= "player" then return end
local sid = getElementData(el, "player:sid")
if not sid then return end
local faction = getElementData(el, "player:faction") -- Pobierz nazw? frakcji z elementu gracza
if not faction then return end
local result = exports["nrpg_db"]:dbGet("SELECT * FROM pystories_factions WHERE uid=? AND faction=? LIMIT 1;", sid, faction) -- Dodaj nazw? frakcji do zapytania
if result and #

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: wypłata :: frakcyjna
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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