Witam, zaczn? ?e jestem ca?kowicie zielony w tym temacie , ale wracaj?c
od pewnego czasu zacz??em bawi? si? paczk? MTA, wszystkie skrypty z bazami danych dzia?aj?, ale nie dzia?a jeden z nich. Jest to skrypt do systemu dom?w.
Po jego uruchomieniu wyrzuca b??d: interiory.lua:26: bad argument #1 to 'ipairs' (table expected, got boolean). Wrzucam tutaj skrypt interiory.lua z tym b??dem.
Po rozwi?zaniu problemu stawiam zimne
Jakby kto? m?g? pom?c poniewa? nie wiem czemu serwer argument "player" odczytuje jako vehicle.
B??d jest w "isPlayerInVehicle"
tutaj kod :
local myMarker = createMarker ( -2184.3120117188, -2454.3474121094, 29.5, "cylinder", 1.5, 255, 255, 0, 170 )
function Sprawdz (player, vehicle)
if isPlayerInVehicle (player) then
if (isElement(vehicle)) and (getElementType(vehicle)=="vehicle") and (getElementModel(vehicle)==531) then
givePlayerMoney ( player, 100 )
else
outputChatBox("Wsi?dz do traktora !", player, 0, 154, 255)
end
end
end
addEventHandler( "onMarkerHit", myMarker, Sprawdz )
Witam przychodz? z b??dem kt?ry pierwszy raz mi si? pojawi?.
strona Servera
addEvent("iyw_kurier:give_cash", true) addEventHandler("iyw_kurier:give_cash", root, function(money)
if money then
local ss = getElementData(client,"player:scorespedytor") local sid = getElementData(client,"player:sid") givePlayerMoney(client,money) setElementData(client,"player:scorespedytor",ss+1) exports["pystories-db"]:dbSet("UPDATE pystories_users SET scorespedytor=? WHERE id=?", ss+1, getElementData(client, "player:sid")) end
end)
bl?d
Expected number, got non-convertible string. This warning may be an error in future versions.
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 ...
addEventHandler("onClientMarkerHit", markerList, function(hit)
if hit ~= localPlayer then return end if isPedInVehicle(localPlayer) then
outputChatBox("Nie mo?esz siedzie? w poje?dzie!", 255, 0, 0) return end
zrobione = zrobione+1
destroyElement(source) destroyElement(blipList) local pieniadz = math.random(10, 200) local pos = math.random(1,#items2) eq:insertItem('items[pos][1]', 1) triggerServerEvent("giveMoney", localPlayer, pieniadz) end
end if zrobione == #punktyListonosza then setElementData(localPlayer, "praca", nil)
return end
end
end) end
Za pomoc resp + piwo , nie wiem proboje dodawac end ale nadal wciaz ten sam blad
[lua]
bindKey("mouse1", "down", function()
if kliki > 99 then
setElementData(localPlayer, "mozna:klikac:drwal", false)
kliki = 0
end
end)
addEventHandler("onClientMarkerHit", markerNapad , function()
triggerServerEvent("giveMoney", localPlayer, pieniadz)
exports["np-notyfikacje"]:noti(" wykonano: "..kasa.."$")
local kasa = math.random(10, 200)
return
gui(localPlayer)
kliki = kliki+1
end
return
end)
[/lua]
i jeszcze gui mi si? nie wy?wietla po wej?ciu w marker
[lua]
function gui()
setElementData(localPlayer, "mozna:klikac:drwal", true)
if kliki > 99 then return end
addEventHandler("onClientRender", root, function()
if not getElementData(localPlayer, "mozna:klikac:drwal") then return end
dxDrawText("Klikaj, aby rozwali? maszynen"..kliki.."/100", (288-1)*px, (253-1)*py, (766-1)*px, (435-1)*py, tocolor(0, 0, 0, 255), 3.00*px, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("Klikaj, aby ?ci?? drzewon"..kliki.."/100", (288+1)*px, (253-1)*py, (766+1)*px, (435-1)*py, tocolor(0, 0, 0, 255), 3.00*px, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("Klikaj, aby ?ci...
Wi?c, pr?buje przenie?? system wzywania z ITS 2017 na Pystories 3.0
Wi?c typowo "elementdaty" zosta?y zmienione na odpowiadaj?ce byciu na "s?u?bie" w frakcji, jak i te? rozwi?za?em problem z "font'em". tylko zacz?? pojawia? si? nowy problem, polegaj?cy na tym ?e nie pojawiaj? si? zg?oszenia (mimo tego ?e s? zapisywane w bazie danych) jak i te? pojawia si? b??d w DS3:
[code]ERROR: (?cie?ka skryptu)iyw_zawiadomieniac.lua:209: bad argument #1 od 'ipars' (table expected, got boolean)[/code]
tak wygl?da kawa?ek kodu gdzie wyst?puje b??d:
[lua]addEvent("ZAWIADOMIENIA:SHOWLIST", true)
addEventHandler("ZAWIADOMIENIA:SHOWLIST", localPlayer, function(q,duty)
frakcja=duty
if not isElement(gridlist) then
gridlist = guiCreateGridList(332*w, 288*h, 703*w, 179*h, false)
guiGridListAddColumn(gridlist, "Zg?aszaj?cy:", 0.3)
guiGridListAddColumn(gridlist, "Opis zdarzenia:", 0.2)
guiGridListAddColumn(gridlist, "Data:", 0.2)
guiGridListAddColumn(gridlist, "Lokalizacja:", 0.2)
guiGridListAddColumn(gridlist, "DBID:", 0.1)
guiGridListAddColumn(gridlist, "SID:", 0)
dxfont0_1 = dxCreateFont(":pystories-logging/font/1.ttf", 10)
addEventHandler("onClientRender", root, render)
addEventHandler("onClientClick", root, click)
editing=false
showCursor(true)
for i,v in ipairs(q) do
local row=guiGridListAddRow(gridlist)
i...
Wie kto? mo?e co tu jest nie tak? W konsoli wywala b??d "Bad argument 1 @ isPlayerInTeam [player expected, got nil]". Dopiero co zacz??em pisa? skrypty
function isPlayerInTeam(player, team)
assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end
addCommandHandler("open",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 8.5 )
end
end)
addCommandHandler("close",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 13.89999961853 )
end
end )
local getSecUsers = dbQuery(organizations_db, "SELECT * FROM users WHERE organization = ?", org_name) local my_number = 0 for _, row in pairs(getSecUsers) do local my_number = mynumber + 1
end
B??d: bad argument to pairs,table expected, not user data
Pr?bowa?em ju? wszelakich opcji, lecz nadal nie dzia?a ten kodzik, wywala expected near po then ;[
addEventHandler('onMarkerLeave', sortmarker,
function(element)
if (getElementType(element) == 'player' then
killTimer(wyplata)
outputChatBox ( "[Informacja] #00FF00Przesta?e? ci?? drewno." )
)
end
end
end
)
Witam robie sobie eventy i przy naciskaniu f5 mam:
[code]C:UsersPatrykDesktopZabawyVIVA.pwn(677) : error 012: invalid function call, not a valid address
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : warning 215: expression has no effect
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : warning 215: expression has no effect
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : warning 215: expression has no effect
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : warning 215: expression has no effect
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : error 001: expected token: ";", but found ")"
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : error 029: invalid expression, assumed zero
C:UsersPatrykDesktopZabawyVIVA.pwn(677) : fatal error 107: too many error messages on one line