..: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?
..: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
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 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)
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