Siema, mam taki problem, doda?em si? do SAPD w mysql i gdy klikam rozpocznij sluzbe pojawia si? w debugscript zebym sprawdzil linijke 42 w s.duty_lua attempt to index local 'result' (a boolean value)
Hej! Mam problem jakiego dozna?em podczas pisania kodu do zasobu virtualparking dla s?u?b na w?asny serwer. Niestety, co? posz?o nie tak, i przy wyborze jakiegokolwiek samochodu z parkingu, wyrzuca komunikat:
function newNoti(el,txt,type)
if el==localPlayer then
if type>3 or type<0 or not tonumber(type) then
type=2
end
local type=types[type][1]
table.insert(msgs,{txt=txt,typ=type,easingFunction="Linear",startTime=getTickCount(),endTime=getTickCount()+5000})
end
end
addCommandHandler("dodaj",function(cmd,typ,...)
local msg=table.concat({...}," ")
newNoti(localPlayer,msg,tonumber(type))
end)
addEventHandler("onClientRender",root,function()
offset=0
for _,v in ipairs(msgs)do
local now = getTickCount()
local elapsedTime = now - v.startTime
local duration = v.endTime - v.startTime
local progress = elapsedTime / duration
local fAnimationTime = getEasingValue(progress, v.easingFunction)
Witam
Chcialem podpi?? baze danych pod serwer
po czym dostaje komunikat z DB1 https://imgur.com/a/ozqywvQ
Wie ktos o co chodzi ?
Z gory dziekuje za pomoc !
Witam pom?g?by kto? z b??dem, robie gui z scrollem.
b??d
attempt to compare number with nil
kod
local screenW, screenH = guiGetScreenSize()
local k = 1
local n = 3
local m = 3
local teksty = {
{"Nazwa0"},
{"Nazwa1"},
{"Nazwa2"},
{"Nazwa3"},
{"Nazwa4"},
}
function gui()
if not getElementData(localPlayer, "system:tune:gui") == true then return end
local dd = 0 for i,v in ipairs(teksty) do
if i >= k and i <= n then
dd = dd + 1
local addY = (screenH * 0.0020) * (dd - 1) dxDrawText(v[1], screenW * 0.3807, screenH * 0.3287 + addY, screenW * 0.6271, screenH * 0.3843, tocolor(74, 63, 63, 255), 1.00, dxfont3_normal, "center", "center", false, false, false, false, false) end
end
Siemaneczko, problemik ze skrypcikiem a dok?adnie [spoiler][img]https://i.imgur.com/2kJTNm4.png[/img]. [/spoiler]
[lua]addCommandHandler("opona", function(_, r, g, b)
local veh = getPedOccupiedVehicle(localPlayer);
if(not veh)then return end;
local tune = getVehicleUpgrades(veh);
for i,v in pairs(tune) do
if(names[v])then
setWheelColor(veh, v, r, g, b);
end;
end;
end);
local vehs = {};
function setWheelColor(veh, id, r, g, b)
if(r and g and b)then
setElementData(veh, "vehicle:wheel", {id, r, g, b});
else
local v = vehs[veh];
if(v)then
engineRemoveShaderFromWorldTexture(v[2], v[3], veh);
addEventHandler("onClientRender", root, function()
for i,v in pairs(getElementsByType("vehicle", true)) do
local wheel = getElementData(v, "vehicle:wheel");
if(not vehs[v] and wheel)then
vehs[v] = {};
zacz??em powoli rozumie? mysql i no korzysta? z tego dobrodziejstwa lecz co? mi nie wychodzi
function biznesNowe(thePlayer, target) id = getElementData(thePlayer, "dbid") zapomnialemoTym = mysql:query_fetch_assoc("SELECT * FROM `characters` WHERE `Liderbiznesu` = '?' AND `id` = '"..id.."'")
if zapomnialemoTym > 0 then
outputChatBox("komunikat!",thePlayer,255,255,255) end
end
na samym pocz?tku by?o samo ? tego '
ps. nada?em se wartosc 1 ale raczej wychodzi? mi taki b??d jak w tytule
Witam, mam problem, wyskakuje mi blad attempt to compare number with string i nie rozumiem o co chodzi (XD)
Tutaj dam czesc kodu ktory jest zwiazany z tym bledem:
function nadawanieGwiazdek(plr,cmd,nick,wartosc) local gracz = getPlayerFromName(nick) local konto = getAccountName(getPlayerAccount(plr)) local kontog = getPlayerAccount(gracz) local poli = getPlayersInTeam(Policja) local bad = "Nieprawidlowe uzycie!nPoprawne uzycie: /wanted <gracz> <gwiazdki>"
if wartosc>0 or wartosc<7 then
setPlayerWantedLevel(gracz,wartosc) setAccountData(kontog,"gwiazdki",wartosc) outputChatBox("dziala")
elseif wartosc==0 then
setPlayerWantedLevel(gracz,0) removeAccountData(kontog,"gwiazdki") outputChatBox("dziala usuwanie")
elseif wartosc<0 or wartosc>6 then if wartosc<0 then
outputChatBox("Minimalna iloscia gwiazdek jest 0!",plr)
elseif wartosc>6 then
outputChatBox("Maksymalna iloscia gwiazdek jest 6!",plr) end
end
Witam, ma kto? pomys? co dok?adnie powinienem zrobi?? B??d wywala na tej linijce: if #q < 1 then
q=exports["pystories-db"]:dbSet("select ownerid,koszt,id from lss_domy where id=?", domid)
if #q < 1 then
client:outputChat("Wyst?pi? b??d, nie znaleziono takiego domu!", 255, 0, 0)
return
end
Witam posiadam dwa problemy
[19-07-24 22:37:57] ERROR: busty/bust_s.lua:20: attempt to compare boolean with number
[19-07-24 22:37:57] WARNING: busty/bust_s.lua:20: Bad argument @ 'getElementData' [Expected element at argument 1, got string 'down']
[lua]
function setbustrpday(plr,days)
if getbustday(plr) then
local queryA=exports['pystories-db']:dbSet(string.format("UPDATE pystories_users SET bust_rp = DATE(bust_rp) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:sid")))
return end
local queryA=exports['pystories-db']:dbSet(string.format("UPDATE pystories_users SET bust_rp = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:sid")))
end
function getbustday(plr)
local queryA=exports['pystories-db']:dbGet("SELECT * FROM pystories_users WHERE id=? AND bust_rp>NOW() LIMIT 1", getElementData(plr,"player:sid"))
if (queryA and #queryA > 0) then
return queryA[1].bust_rp
end
return false
end
addEvent("dajbusta", true)
addEventHandler("dajbusta", resourceRoot, function(dni,plr,value)
if getElementData(plr,"player:pktgry") == 10 then triggerClientEvent(plr, 'onClientAddNotification', plr, "Kupi?e? busta RP na 1 dzie? ", 'succes')--linijka 18
else
if not getElementData(plr,"player:pktgry")<10 then triggerClientEvent(plr, 'onClientAddNotification', plr, "Nie posiadasz odpowiedniej ...
my?l? i my?l? jak zrobi? by nie wywala?o wciska?em wsz?dzie ju?
attempt to call global 'playSound' (a nil value)
[lua]addCommandHandler("b", function(plr,cmd,cel,x,bantype,...)
if BWADMIN(plr,3) or BWADMIN(plr,2) or BWADMIN(plr,1) or BWADMIN(plr,5) or BWADMIN(plr,4) or BWADMIN(plr,7) then
local reason=table.concat({...}, " ")
if not cel or not tonumber(x) or not bantype or not reason then
--outputChatBox("#007aff(ⓘ) #FFFFFFU?ycie: /b <nick/ID> <ilo??> <m/h/d> <pow?d>", plr, 255,255,255, true)
triggerClientEvent(plr, 'onClientAddNotification', plr, "U?ycie: /b <nick/ID> <ilo??> <m/h/d> <pow?d>nm - Minuty h - Godziny d - Dni ", 'info')
return
end
local target=exports["bw-core"]:findPlayer(plr,cel)
if not target then
triggerClientEvent(plr, 'onClientAddNotification', plr, "Nie znaleziono podanego gracza.", 'error')
return
end
if (BWADMIN(plr,7) == false) and BWADMIN(target,7) then return end
if target then
local muza = playSound("ban.mp3") return
end
--reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
if bantype=="m" or bantype=="h" or bantype=="d" then
if bantype=="m" then
exports["bw-db"]:bazaustaw("INSERT INTO bw_zbanowanij (serial,reason,time,type) VALUES (?,?,NOW() +...
mam problem z kodem 27 linia local dim=split(getnajwyzszydim.intdim_wnetrza,",")
[lua]addCommandHandler("adddomek2",
function(plr,cmd,cena,miejsca_parkingowe,id_interioru,id_garazu,pozycja_wyjscia)
if not iswlasciciel(plr) and (getElementData(plr,"dbid")~=1) then
return
end
if not cena or not tonumber(cena) or not miejsca_parkingowe or not id_interioru or not id_garazu then
exports["komunikaty"]:komunikat("/adddomek [cena] [miejsca_parkingowe] [id_interioru <0-23>] [id_garazu] [x,y,z_wyjscia]", plr)
return
end
local z_i=nil
for i,v in ipairs(inside) do
if (tonumber(id_interioru)==i) then
z_i=v
end
end
if not z_i then
exports["komunikaty"]:komunikat("Nieprawid?owy identyfikator interioru.", plr)
return
end
local pozycja=string.format("%s,%s,%s", z_i.poz[1], z_i.poz[2], z_i.poz[3])
if not pozycja_wyjscia then
local px,py,pz=getElementPosition(plr)
pozycja_wyjscia=string.format("%s,%s,%s", px,py,pz)
end
local pozycja_markera=string.format("%s,%s,%s", z_i.marker_wejscie[1], z_i.marker_wejscie[2], z_i.marker_wejscie[3])
local getnajwyzszydim=exports.DB:pobierzWyniki("SELECT intdim_wnetrza FROM domy ORDER BY id DESC LIMIT 1")
local dim=split(getnajwyzszydim.intdim_wnetrza,",")
dim=tonumber(dim[2])
dim=dim+1
addDomek(plr,cena,miejsca_parkingowe,pozycja,z_i....
witam mam problem z kodem attempt to compare number with string
function autoryzujRanga(client, id)
if not isElement(client) then return end
local autoryzacja=exports.DB:pobierzWyniki("SELECT ranga, ranga_dodatkowa FROM gracze WHERE id=?",id)
if autoryzacja.ranga and autoryzacja.ranga>0 and autoryzacja.ranga<6 then if autoryzacja.ranga == 4 then
ranga="Developer" elseif autoryzacja.ranga == 3 then
ranga="Guardian" elseif autoryzacja.ranga == 2 then
ranga="Administrator" elseif autoryzacja.ranga == 1 then
ranga="Supporter" end
setElementData(client, "ranga", autoryzacja.ranga) exports["komunikat"]:komunikat("Posiadasz rang?: "..ranga..".",client) end
if autoryzacja.ranga_dodatkowa and autoryzacja.ranga_dodatkowa < 4 then if autoryzacja.ranga_dodatkowa == 4 then
ranga_dod="Programista" elseif autoryzacja.ranga_dodatkowa == 3 then
ranga_dod="Grafik" elseif autoryzacja.ranga_dodatkowa == 2 then
ranga_dod="Modeler" elseif autoryzacja.ranga_dodatkowa == 1 then
ranga_dod="Mapper" end
setElementData(client, "ranga_dodatkowa", autoryzacja.ranga_dodatkowa) exports["komunikat"]:komunikat("Posiadasz rang? dodatkow?: "..ranga_dod..".",client) end
end
ERROR: skrypty/s.lua:90 attempt to index filed '?' (a nil value)
function load_magazynier_table() local q = exports.MXL_dbb:mysql_query("select * from MXL_users order by punkty_magazynier desc") local ranking_table = {}
for i = 1,5 do
>>>90 table.insert(ranking_table, q[i]["login"]..": "..q[i]["punkty_magazynier"].." punkt?w") end
addEventHandler("onClientRender",root,function ()
if not isPedInVehicle(localPlayer) then return end
local veh = getPedOccupiedVehicle(localPlayer) local sx,sy,sz = getElementVelocity(veh) local kmhs = math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
if kmhs >= 10 then
local view = getElementData(veh,"viewki") local view = view + 0.015 if view >= 200 then return end
local viewki = setElementData(veh,"viewki",view) setElementData(veh,"vehicle:desc","Mapa : [ "..string.format("%01d",view).." MB ]") end
end)
PDM-raport/server.lua:598: attempt to concatenate a boolean value
addCommandHandler("raport", function(plr,cmd,cel,...)
if not cel then
outputChatBox("U?yj: /raport <kawa?ek nick'u> <pow?d>", plr)
return
end
local target = findPlayer(plr,cel)
if not target then
outputChatBox("Nie znaleziono podanego gracza.", plr, 255, 0, 0)
return
end
local text=table.concat({...}, " ")
desc = getPlayerName(plr).."("..getElementData(plr,"id")..") >> "..getPlayerName(target).."("..getElementData(target,"id").."): "..text
triggerClientEvent(root, "admin:addReport", resourceRoot, desc, getElementData(target,"id"))
outputChatBox("Pomy?lnie wys?ano zg?oszenie na gracza: "..getPlayerName(target), plr)
end)
Stawiam za dobr? pomoc i wyt?umaczenie i
PS: Przepraszam jak z?y dzia? ale chyba dobry Troch? si? nie orientuj?.
Witam co? nie ??czy nie wiem o co chodzi pr?bowa?em co? zmienia? ale nie dzia?a.
B??d : ERROR: [skrypty]/YL-pojazdy/s_vehbuy.lua:278: attempt to call global 'getAdmin' (a nil value)
Skrypt:
addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
if seat == 0 then
local rent=getElementData(source, "vehicle:rent") local group=getElementData(source, "vehicle:ownedGroup")
if group == "0" then group = "Brak" end
local player=getElementData(source, "vehicle:ownedPlayer")
if (getAdmin(plr,4)) then return end if rent and (type(rent) == "table") then for i,s in pairs(rent) do
if tonumber(s) == getElementData(plr,"player:sid") then return end
end
end
local plrgroup = getElementData(plr,"player:organization")
if plrgroup then if getSettings(plr,false,"organization") == group then return end
end if player and player ~= getSettings(plr,false,"owner") then
outputChatBox("* Nie posiadasz kluczyk?w do tego pojazdu.", plr) cancelEvent() end
end
end)
No wi?c 3 dni temu zacz??em nauk? j?zyka Lua (chc? w przysz?o?ci postawi? jaki? serwer MTA:SA) i postanowi?em na swoje pierwsze zadanie wykona? prost? prac? dowoziciela Pizzy. W pewnym momencie gracz musi stan?? w obr?bie markera, b?d?c na skuterze. I problem w tym, ?e mam problem ze sprawdzeniem tego - wyskakuje b??d.
Po stronie clienta za ka?dym razem, gdy wsi?dzie w jakikolwiek pojazd jest zapisywana zmienna z jego nazw?:
[lua]
function checkVehicles()
theVehicle = getPedOccupiedVehicle(source)
pojazd = getVehicleName(theVehicle)
end
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),checkVehicles)
[/lua]
a po stronie serwera jest utworzony marker i funkcja przywo?uj?ca zmienn? pojazd (t? po stronie clienta):
function MarkerHit( hitElement, matchingDimension )
local elementType = getElementType( hitElement )
outputChatBox( elementType.." inside myMarker", getRootElement(), 255, 255, 0 )
outputChatBox("pojazd: "..pojazd)
end
addEventHandler( "onMarkerHit", marker, MarkerHit )
[/lua]
No i przy wej?ciu w marker w okienku czatu, ?e player wszed? w marker, przy wjechaniu skuterem, wyskakuje ?e player i vehicle - co jest wporzadku. Problem jest z t? dan? pojazd. W konsoli przy ka?dym wej?ciu w marker pojawia si? komunikat:
ERROR: mojserverscript.lua:66: attempt to concatenate glo...
Mam tak? komende i ona poprawnie nie dzia?a w logach wyskakuje taki b??d
server.lua:288: attempt to index field '?' (a nil value)
addCommandHandler("kp",
function(plr,cmd,car_id) local car_id= tonumber(car_id) local PrivCarOwner = getElementData(PrivCarSystem.DATA[player_id].vehicle,"PrivOwnerCar") --tutaj jest nick gracza (288 linijka) local players = getPlayerFromName(PrivCarOwner) setElementData(players ,"PrivCarId", 0) end)
Gdy m?j skrypt rozwo?enia towar?w "poszed? do naprawy", postanowi?em napisa? w?asn? frakcj? policji, ze wszystkim (wi?zienie, spawn, brama) w jednym skrypcie.
Ale wyskakuje mi b??d Attempt to concatenate global 'jailPlayer' (a userdata value), dok?adnie w tej linijce: