Tibi [NextMTA] Posted July 10, 2017 Share Posted July 10, 2017 (edited) (sry for my bad english) Hi everyone! In my script when I write the command into game chatbox (/makeveh "myID" "CarModelName" "Faction" "R, G, B") i get this Error message to server console: ERROR: mta_vehicle\sourceS.lua:263: attempt to compare boolean with number. The code is: addCommandHandler("makeveh", function(player, _, ownerID, modelID, faction, r, g, b) if getElementData(player, "acc:admin") >= 7 then <--LINE 263 if not modelID or not tonumber(ownerID) then outputChatBox(rovid .. " /makeveh [Név/ID] [Model] [Frakció] [R] [G] ", player, 0, 0, 0, true) return end target, targetName = exports.mta_main:findPlayer(player, ownerID) if not target then return else ownerID = getElementData(target, "char:id") end if not tonumber(faction) then faction = 0 end if not tonumber(r) then r = 0 end if not tonumber(g) then g = 0 end if not tonumber(b) then b = 0 end r = tonumber(r) g = tonumber(g) b = tonumber(b) local vehname = tonumber(modelID) if not vehname then vehname = getVehicleModelFromName(modelID) end if not vehname then outputChatBox(rovid .. " Hibás jármű név vagy id", player, 0, 0, 0, true) return end local x, y, z = getElementPosition(target) local insertQuery = dbQuery(con, "INSERT INTO vehicle SET model=?, owner=?, pos=?, color=?, faction=?, rendszam=?", vehname, ownerID, toJSON({x,y,z}), toJSON({r,g,b}), faction, "modify") local insertResult, _, insertID = dbPoll(insertQuery, -1) if insertResult then addVehicle(ownerID, vehname, x, y, z, insertID, r, g, b, faction) exports.mta_item:giveItem(target, 34, insertID, 1, 0) exports.mta_admin:outputDeveloperMessage("#7cc576"..player:getData("char:anick").." #fffffflétrehozott egy járművet (ID: "..insertID.." Tulaj: "..targetName:gsub("_", " ")..")") dbFree(insertQuery) end endend) Edited July 10, 2017 by Tibi [NextMTA] Link to comment
koragg Posted July 10, 2017 Share Posted July 10, 2017 Please post code in the code editor ... how would we know which line is that? Link to comment
Tibi [NextMTA] Posted July 10, 2017 Author Share Posted July 10, 2017 2 minutes ago, koragg said: Please post code in the code editor ... how would we know which line is that? From the top the second line but I marked Link to comment
itHyperoX Posted July 10, 2017 Share Posted July 10, 2017 thats not your script. Make it your own. (Leaked script) Link to comment
Deep thinker Posted July 10, 2017 Share Posted July 10, 2017 3 minutes ago, TheMOG said: thats not your script. Make it your own. (Leaked script) any proofs? Link to comment
koragg Posted July 10, 2017 Share Posted July 10, 2017 @ProMax try this: if getElementData(player, "acc:admin") and getElementData(player, "acc:admin") >= 7 then Link to comment
Deep thinker Posted July 10, 2017 Share Posted July 10, 2017 Just now, koragg said: @ProMax try this: if getElementData(player, "acc:admin") and getElementData(player, "acc:admin") >= 7 then i am not the one who needs help 1 Link to comment
koragg Posted July 10, 2017 Share Posted July 10, 2017 I mean @Tibi [NextMTA] lol. You posted "any proofs" and I thought you were the OP 1 Link to comment
itHyperoX Posted July 10, 2017 Share Posted July 10, 2017 1 hour ago, ProMax said: any proofs? from this server: https://www.youtube.com/watch?v=j2WlOyvdKAk&t=9632s And other parts of this script addCommandHandler("makeveh", function(player, _, ownerID, modelID, faction, r, g, b) if getElementData(player, "acc:admin") >= 7 then if not modelID or not tonumber(ownerID) then outputChatBox(rovid .. " /makeveh [Név/ID] [Model] [Frakció] [R] [G] [B]", player, 0, 0, 0, true) return end target, targetName = exports.mta_main:findPlayer(player, ownerID) if not target then return else ownerID = getElementData(target, "char:id") end if not tonumber(faction) then faction = 0 end if not tonumber(r) then r = 0 end if not tonumber(g) then g = 0 end if not tonumber(b) then b = 0 end r = tonumber(r) g = tonumber(g) b = tonumber(b) local vehname = tonumber(modelID) if not vehname then vehname = getVehicleModelFromName(modelID) end if not vehname then outputChatBox(rovid .. " Hibás jármű név vagy id", player, 0, 0, 0, true) return end local x, y, z = getElementPosition(target) local insertQuery = dbQuery(con, "INSERT INTO vehicle SET model=?, owner=?, pos=?, color=?, faction=?, rendszam=?", vehname, ownerID, toJSON({x,y,z}), toJSON({r,g,b}), faction, "modify") local insertResult, _, insertID = dbPoll(insertQuery, -1) if insertResult then addVehicle(ownerID, vehname, x, y, z, insertID, r, g, b, faction) exports.mta_item:giveItem(target, 34, insertID, 1, 0) exports.mta_admin:outputDeveloperMessage("#7cc576"..player:getData("char:anick").." #fffffflétrehozott egy járművet (ID: "..insertID.." Tulaj: "..targetName:gsub("_", " ")..")") dbFree(insertQuery) end end end) addCommandHandler("delveh", function(player, _, vehID) if getElementData(player, "acc:admin") < 7 then return end if not tonumber(vehID) then outputChatBox(rovid .. " /delveh [ID]", player, 0, 0, 0, true) return end vehID = tonumber(vehID) for _, car in ipairs(getElementsByType("vehicle")) do if tonumber(car:getData("veh:id")) == vehID then if getElementData(car, "rent.Owner") then setElementData(getElementData(car, "rent.Owner"), "rent.Car", false) end destroyElement(car) delQuery = dbQuery(con, "DELETE FROM vehicle WHERE id=?", vehID) exports.mta_admin:outputDeveloperMessage("#7cc576"..player:getData("char:anick").." #fffffftörölt egy járművet (ID: "..vehID..")") dbFree(delQuery) end end end) function addVehicle(tulajID, modelID, x, y, z, sqlID, r, g, b, fraki) if not fraki then fraki = 0 end local vehicleCreate = createVehicle(modelID,x,y,z) local str = "abcdefghijklmnopqrstuvwxyz" local plate = "" for index = 1, 3 do plate = plate .. string.char(str:byte(math.random(1, #str))) end plate = string.upper(plate) plate = plate .. "-" for index = 1, 3 do plate = plate .. math.random(1, 9) end setVehiclePlateText(vehicleCreate, plate) local insertQuery = dbQuery(con, "UPDATE vehicle SET rendszam=? WHERE id=?", plate, tonumber(sqlID)) dbFree(insertQuery) vehicleCreate:setData("veh:id",tonumber(sqlID)) vehicleCreate:setData("veh:perm",true) vehicleCreate:setData("veh:interior",0) vehicleCreate:setData("veh:dimension",0) vehicleCreate:setData("veh:fuel",10) vehicleCreate:setData("veh:light",true) vehicleCreate:setData("veh:motor",false) vehicleCreate:setData("veh:owner",tonumber(tulajID)) for _, v in ipairs(getElementsByType("player")) do if v:getData("char:id") == tulajID then oname = v:getData("char:name") end end vehicleCreate:setData("veh:oname", oname) vehicleCreate:setData("veh:faction",tonumber(fraki)) vehicleCreate:setData("handbrake",false) setVehicleColor(vehicleCreate,r,g,b) setVehicleOverrideLights(vehicleCreate, 1) -- Kikapcsolva setElementInterior(vehicleCreate,0) setElementDimension(vehicleCreate,0) if getVehicleType(vehicleCreate) == "BMX" then setVehicleEngineState(vehicleCreate,true) else setVehicleEngineState(vehicleCreate,false) end end function saveVehicle(veh) local dbid = tonumber(getElementData(veh, "veh:id")) or 0 if isElement(veh) and tostring(getElementType(veh)) == "vehicle" and dbid >= 0 then local fuel = getElementData(veh, "veh:status") local engine = getElementData(veh, "veh:motor") or false local locked = isVehicleLocked(veh) local fuel = getElementData(veh, "veh:fuel") local neon = tonumber(getElementData(veh, "veh:neon") or 0) local lights = getVehicleOverrideLights(veh) local health = getElementHealth(veh) local wheel1, wheel2, wheel3, wheel4 = getVehicleWheelStates(veh) local wheelState = toJSON( { wheel1, wheel2, wheel3, wheel4 } ) local panel0 = getVehiclePanelState(veh, 0) local panel1 = getVehiclePanelState(veh, 1) local panel2 = getVehiclePanelState(veh, 2) local panel3 = getVehiclePanelState(veh, 3) local panel4 = getVehiclePanelState(veh, 4) local panel5 = getVehiclePanelState(veh, 5) local panel6 = getVehiclePanelState(veh, 6) local panelState = toJSON( { panel0, panel1, panel2, panel3, panel4, panel5, panel6 } ) local door0 = getVehicleDoorState(veh, 0) local door1 = getVehicleDoorState(veh, 1) local door2 = getVehicleDoorState(veh, 2) local door3 = getVehicleDoorState(veh, 3) local door4 = getVehicleDoorState(veh, 4) local door5 = getVehicleDoorState(veh, 5) local doorState = toJSON( { door0, door1, door2, door3, door4, door5 } ) local x,y,z = getElementPosition(veh) local int = getElementInterior(veh) local dim = getElementDimension(veh) --local pos = toJSON({x,y,z,int,dim}) if dbPoll ( dbQuery( con, "UPDATE vehicle SET panel=?, wheel=?, door=?, fuel=?, motor=?, status=?, lampa=?, hp=? WHERE id='?'", panelState, wheelState, doorState, fuel, engine, locked, lights, health,dbid), -1 ) then -- outputDebugString("Mentve") end -- if dbPoll (dbQuery( kapcsolat,"UPDATE jarmuvek SET TuningMotor=?,TuningTurbo=?,TuningGumi=?,TuningFek=? WHERE id=?",Motor,Turbo,Gumik,Fek,dbid), -1 ) then -- outputDebugString("Jármű teljesítmény-ek mentve!") -- end end end function saveAllVeh() local count = 0 for i, p in ipairs(getElementsByType("vehicle")) do if (tonumber(getElementData(p, "veh:owner") or 0) >= 1) then saveVehicle(p) count = count + 1 end end outputDebugString("El lett mentve "..count.." kocsi adata!",0,0,130,150) end 1 Link to comment
Discord Moderators Pirulax Posted July 11, 2017 Discord Moderators Share Posted July 11, 2017 (edited) The problem is that the element data named "acc:admin" doesnt exists.. try to relog.. if that doesnt help, then just download the newest version..The newest mod is publicated by DNS.. like 6 days ago And guys, it is a leaked script... But let him open an External edit server, and i cant do some NON on it >DD Edited July 11, 2017 by Pirulax Link to comment
Gordon_G Posted July 11, 2017 Share Posted July 11, 2017 If it's a leaked script, the MTA community will not help him. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now