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
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)
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, posiadam cudzy kod jednej z pracy kosiarki i naprawiam w niej b??dy.
Mam problem poniewa? nie wiem jak naprawi? dwa errory:
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(localPlayer) then 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(plr, seat)
if seat == 0 then if plr == localPlayer then
destroyElement(veh) end
end
end)
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...
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, -...