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)
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)
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()
for i=1,#czescihuda[1] do showPlayerHudComponentVisible(czescihuda[1][i], false) end
end)
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
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....
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
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)
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...
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)
Chcia?bym pobra? z bazy danych model samochodu, jaki ma si? zrespi?, lecz niestety baza danych zwraca nil, zamiast modelu. B??d: Bad argument @ 'createVehicle' [Expected number at argument 1, got nil]
addEventHandler("onResourceStart", resourceRoot,
function() baza = dbConnect("sqlite", "vehicles.db") end )
addCommandHandler("spawn",
function(playerSource) local query = dbQuery(baza, "SELECT ? FROM `cars` WHERE owner=?", "model", getAccountName(getPlayerAccount(playerSource))) local result = dbPoll(query, -1) outputDebugString(tostring(result)) local posX, posY, posZ = getElementPosition(playerSource) createVehicle(tonumber(result[1]), posX, posY, posZ) dbFree(query) end )
Runtime error at line -1:.....logowaniec_logo.lua:23. attempt to call global 'getRootElement' (a nil value). Podobny error po stronie serwera w 1 linijce. Nie dzia?a r?wnie? triggering - my?la?em z godzink? i za nic nie wiem co jest nie tak.
CLIENT:
[code]GUIEditor = {
window = {},
button = {},
label = {},
edit ={}
}