..:D&G:.. Posted November 19, 2013 Posted November 19, 2013 I get an error for a script (table expected, got nil) even if there is a table, local vehicles = {}, does anyone know why? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Castillo Posted November 19, 2013 Posted November 19, 2013 Post your script. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
..:D&G:.. Posted November 20, 2013 Author Posted November 20, 2013 Here local vehElements = {} -- Functii function showVehicleGui(vehElementsret) if not wvehicle then local width, height = 400, 200 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth - width local y = scrHeight/10 wvehicle = guiCreateWindow(x, y, width, height, "Tractari: Recupereaza un vehicul", false) guiWindowSetSizable(wvehicle, false) bInchide = guiCreateButton(0.5, 0.85, 0.2, 0.1, "Iesi", true, wvehicle) bVehicul = guiCreateButton(0.725, 0.85, 0.3, 0.2, "Recupereaza", true, wvehicle) addEventHandler("onClientGUIClick", bClose, hideImpoundUI, false) addEventHandler("onClientGUIClick", bRelease, releaseCar, false) gMasini = guiCreateGridList(0.05, 0.1, 0.9, 0.65, true, wvehicle) addEventHandler("onClientGUIClick", gMasini, updateCar, false) local col = guiGridListAddColumn(gMasini, "Vehicule Confiscate", 0.7) IDcolumn = guiGridListAddColumn(gMasini, "ID", 0.2) vehElements = vehElementsret for key, value in ipairs(vehElements) do local dbid = getElementData(value, "dbid") local row = guiGridListAddRow(gCars) guiGridListSetItemText(gCars, row, col, getVehicleName(value), false, false) guiGridListSetItemText(gCars, row, IDcolumn, tostring(dbid), false, false) end guiGridListSetSelectedItem(gCars, 0, 1) lCost = guiCreateLabel(0.1, 0.85, 0.2, 0.1, "Taxă: 100 lei", true, wvehicle) guiSetFont(lPret, "default-bold-small") updateCar() guiSetInputEnabled(true) end end MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
TAPL Posted November 20, 2013 Posted November 20, 2013 That's because you overwrite it at line 20 and it's seems that the vehElementsret is nil.
..:D&G:.. Posted April 14, 2014 Author Posted April 14, 2014 And what do you suggest me to do? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
JR10 Posted April 14, 2014 Posted April 14, 2014 Show us the part where showVehGui is called. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
..:D&G:.. Posted April 14, 2014 Author Posted April 14, 2014 Client side: function scoateMasina(button) if (button=="left") then local row = guiGridListGetSelectedItem(gCars) hideImpoundUI() triggerServerEvent("scoateMasina", getLocalPlayer(), vehElements[row+1]) end end addEvent("arataScosul", true) addEventHandler("arataScosul", getRootElement(), showVehicleGui) Server side: function platesteScos(vehID) if exports.bani:iaBani(source, 225) then exports.bani:daBani(getTeamFromName("Tractari Auto"), 225) setElementFrozen(vehID, false) local x, y, z, int, dim, rotation = getReleasePosition() setElementPosition(vehID, x, y, z) setVehicleRotation(vehID, 0, 0, rotation) setElementInterior(vehID, int) setElementDimension(vehID, dim) setVehicleLocked(vehID, true) exports['exports-stuffs']:setProtectedElementData(vehID, "motormort", 0, false) setVehicleDamageProof(vehID, false) setVehicleEngineState(vehID, false) exports['exports-stuffs']:setProtectedElementData(vehID, "frana", 0, false) exports['exports-stuffs']:setProtectedElementData(vehID, "scos", 0) outputChatBox("Test test release", source, 255, 194, 14) else outputChatBox("Insufficient funds.", source, 255, 0, 0) end end addEvent("scoateMasina", true) addEventHandler("scoateMasina", getRootElement(), platesteScos) MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
..:D&G:.. Posted April 15, 2014 Author Posted April 15, 2014 Well? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
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