Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: value
1. attempt to perform arithmetic on a boolean value
witam mam taki b??d attempt to perform arithmetic on a boolean value
Kod:

setElementData(source,"player:money",getElementData(source,"player:money")+kwota)
2. a boolean value (mysql)
Mam problem z:
[lua]local db = exports['rpg_db']

addEvent('login', true)
addEventHandler('login', root, function(login, pass)
local res = db:query("SELECT * FROM authorize WHERE login=?", login)
local resm = db:query(res, -1)
if resm[1].login == 0 then
outputChatBox('takie konto nie istnieje k****')
return
end
if resm[1].pass ~= pass then
outputChatBox('zle haslo')
return
end
setElementData(client, "player:dbid", res[1].dbid)
end)

addEvent('new', true)
addEventHandler('new', root, function(login, pass)
local res = db:query('SELECT * FROM authorize WHERE login=?', login)
local resm = db:query(res, -1)
if #resm > 0 then
outputChatBox('takie konto juz jest')
return
end
db:execute('INSERT INTO authorize (login,pass) VALUES (?,?)', login, pass)
outputChatBox('zrobiles konto')
end)[/lua]

[lua]
function query(...)
local queryHandle = dbQuery(DBConnection, ...)
if (not queryHandle) then
return nil
end
local rows = dbPoll(queryHandle, -1)
return rows
end

function execute(...)
local queryHandle = dbQuery(DBConnection, ...)
local result, numRows = dbPoll(queryHandle, -1)
return numRows
end[/lua]

query i execute:

db3:
[img]https://i.imgur.com/ZRjh34I.png[/img]

pierwsze dwie s? od logowania,
pozosta?e dwie od rejestracji

[ Dodano : 2021-03-19, 20:05 ]
struktur...
3. A nil value przy ShowPlayerHudComponentVisible
Siema, mam problemik, gdy? zrobi?em testowy hud a mam problem z podana w nazwie funkcj?.
Tu macie kod i b??d:
B??D: attempt to call 'ShowPlayerHudComponentVisible' (a nil value)

Kod:

hud
={}
czescihuda={
    {
"ammo","armour","clock","health","money","weapon","wanted"}
}

hud.font=dxCreateFont("font.ttf",15,false,"antialiased")
hud.font2=dxCreateFont("font.ttf",20,false,"antialiased")
hud.font3=dxCreateFont("font.ttf",20,false,"antialiased")
hud.font4=dxCreateFont("font.ttf",15,false,"antialiased")



addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()
    for 
i=1,#czescihuda[1] do
        
showPlayerHudComponentVisible(czescihuda[1][i], false)
    
end
end
)
4. nil value i ipairs
for kv in ipairs (playersOnPoliceTeam and getPlayersInTeamgetTeamFromName"Los Santos Police Department" ) ) ) do


a w debugscripcie wyswietla sie to -
bad argument #1 to 'ipairs' [table excepted, got boolean
5. Button nil value
Witam posiadam frakcje z gm PSSM i we frakcji SAPD nie moge wyciaga? pojazd?w z prakingu wirtualnego.


[lua]local screenW, screenH = guiGetScreenSize()

function pokazgui()
exports["buttons"]:createCustomWindow("Wirtualny Parking", screenW * 0.2016, screenH * 0.2286, screenW * 0.6092, screenH * 0.5805, tocolor(255, 255, 255, 255), false)
exports["buttons"]:createCustomButton("Akademia", screenW * 0.2192, screenH * 0.3019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Radiow?z", screenW * 0.3692, screenH * 0.3019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Radiow?z2", screenW * 0.5292, screenH * 0.3019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Merit", screenW * 0.6792, screenH * 0.3019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Enforcer", screenW * 0.2192, screenH * 0.4019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Premier", screenW * 0.3692, screenH * 0.4019, screenW * 0.1094, screenH * 0.0600, tocolor(255,255,255,255), false)
exports["buttons"]:createCustomButton("Holownik", screenW ...
6. a nil value
witam robi? system ban?w lecz nie wiem co jest tak kod
end
            setElementData
(client"player:uid"result[1].id)
                if (
isPlayerBanned(source)) then return end

            triggerClientEvent
(client"logging:result"resourceRoottrue"Zalogowa?e? si? pomyslnie","git")
b??d:s_logging.lua:80: attempt to call global 'isPlayerBanned' (a nil value) jest to sprawek kodu my?l? ?e pomo?e kto?
7. attempt to concatenate a boolean value
Siema, podczas sprawdzania dzia?alno?ci skryptu wyskakuje taki error. Daje fragment kodu. A linijka 598 zaczyna si? tak.
Kod:

desc = getPlayerName(plr).."("..getElementData(plr,"id")..") >> "..getPlayerName(target).."("..getElementData(target,"id").."): "..text

PDM-raport/server.lua:598: attempt to concatenate a boolean value

Kod:

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 :piwo: i R*

PS: Przepraszam jak z?y dzia? ale chyba dobry :) Troch? si? nie orientuj?.
8. a boolean value
Witam, od pewnego czasu m?cz? si? z prac?

jest jeden b??d




eexp 
math.random(12,22)

 
local sparrowexp getElementData(localPlayer"sparrowexp")

setElementData(localPlayer"sparrowexp"sparrowexp+eexp)-- to jest ta 116 linijka

w zapisie statystyk danych gracza jest elementData "sparrowexp"
9. a boolean value
Witam, posiadam cudzy kod jednej z pracy kosiarki i naprawiam w niej b??dy.
Mam problem poniewa? nie wiem jak naprawi? dwa errory:
Kod:


ERROR: praca/client.lua:13: attempt to perform arithmetic on local 'trawa' (a boolean value)
ERROR: praca/client.lua:8: attempt to perform arithmetic on local 'px' (a boolean value)


Kod:

addEventHandler
("onClientRender"root,
    function ()
        if 
not isPedInVehicle(localPlayerthen return end
        local veh 
getPedOccupiedVehicle(localPlayer)
        
        
local px,py,psz getElementVelocity(veh)
        
        
local predkosct math.ceil(((px^2+py^2+psz^2)^(0.5))*140)
        if 
predkosct >= 1 then
        
        local trawa 
getElementData(veh"trawa")
        
        
local zebranat trawa 0.03
        local trawa1 
setElementData(veh"trawa"zebranat)  
        
end
    end
)

addEventHandler("onClientVehicleExit"resourceRoot, function(plrseat)
    if 
seat == 0 then
        
if plr == localPlayer then
            destroyElement
(veh)
        
end
    end
end
)
10. a nil value
db3
attempt to call global '3DResim' (a nil value)

ta funkcja
[lua]
function _3DResim(TheElement,Image,distance,height,width,R,G,B,alpha)
local x, y, z = getElementPosition(TheElement)
local x2, y2, z2 = getElementPosition(localPlayer)
local distance = distance or 20
local height = height or 1
local width = width or 1
local checkBuildings = checkBuildings or true
local checkPeds = checkPeds or false
local checkObjects = checkObjects or true
local checkDummies = checkDummies or true
local seeThroughStuff = seeThroughStuff or false
local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
local ignoredElement = ignoredElement or nil
if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
local sx, sy = getScreenFromWorldPosition(x, y, z+height)
if(sx) and (sy) then
local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
if(distanceBetweenPoints < distance) then
dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/dis...
11. attempt to concatenate a boolean value
nickRoot "#0066cc ["..getElementData(v,"id_uzytkownik").."] #FFFFFF"..getPlayerName )


wywala error attempt to concatenate a boolean value. ktos cos?
12. Boolean/Table Value (zapis handlingu w SQL)
Witam, pr?bowa?em dzisiaj do systemu prezesa doda? zapis handlingu (na pr?be engineAcceleration), jednak?e co? musz? miec ?le w kodzie:
[lua]--[[
Ten plik zawiera:
* tworzenie aut przy uruchomieniu skryptu
* laczenie sie z baza SQL Lite
* zapis danych aut co 15 min i przy wylaczeniu skryptu
* komende dla administratora sluzaca zapisowi aut
* funkcje blokujaca wejscie do auta jesli nie jestesmy jego wlascicieleme
--]]


handler = dbConnect("sqlite", "pojazdy.db")

--pojazdy
dbExec(handler, "CREATE TABLE IF NOT EXISTS pojazdy (id INTEGER PRIMARY KEY AUTOINCREMENT, wlasciciel TEXT, model INTEGER, x FLOAT, y FLOAT, z FLOAT, rotx FLOAT, roty FLOAT, rotz FLOAT, ca INTEGER, cb INTEGER, cc INTEGER, cd INTEGER, ce INTEGER, cf INTEGER, przebieg FLOAT, handling FLOAT)")
dbExec(handler, "CREATE UNIQUE INDEX IF NOT EXISTS IDX_id on pojazdy(id)")

--tuning
dbExec(handler, "CREATE TABLE IF NOT EXISTS tuning (id INTEGER, t0 INTEGER, t1 INTEGER, t2 INTEGER, t3 INTEGER, t4 INTEGER, t5 INTEGER, t6 INTEGER, t7 INTEGER, t8 INTEGER, t9 INTEGER, t10 INTEGER, t11 INTEGER, t12 INTEGER, t13 INTEGER, t14 INTEGER, t15 INTEGER, t16 INTEGER, paintjob INTEGER, hr INTEGER, hg INTEGER, hb INTEGER)")
dbExec(handler, "CREATE UNIQUE INDEX IF NOT EXISTS IDX_id on tuning(id)")


function onStartLoadVehicles()
local query = dbQuery(handler, "SELECT * FROM pojazdy")
local result, num_rows, errormsg = dbPoll (query, -...
13. SMS API - attempt to index a nil value
Do zamkni?cia :)
14. Value itemu
Witam chc? na vG w skrypcie zespawnowac item z value takiego jak nick gracza korzystaj?c z getPlayerName

Kod:

exports.global:giveItem( client, 139, <tu chce zeby sciagalo nick gracza> )