yToPzz Posted October 23, 2022 Share Posted October 23, 2022 [2022-10-23 16:48:42] WARNING: Painel-Som\client\gui.lua:255: Bad argument @ 'getVehicleName' [Expected vehicle at argument 1, got boolean] addEvent ("tune.sync_objects", true); addEventHandler ("tune.sync_objects", root, function (veh, objects) local g = tune.gridlist[3]; local label_text = isPedInVehicle (localPlayer) and getVehicleName(getPedOccupiedVehicle(localPlayer)) or "none" ---- line error tune.label[5]:setText("Você deve estar em um veículo para usar este painel.\nVeículo atual: ".. label_text); guiGridListClear (g); if not isPedInVehicle (localPlayer) then return; end if not veh or not objects then return; end for i=#objects, 1, -1 do local v = objects[i]; if isElement (v) then local row = guiGridListAddRow (g); guiGridListSetItemText (g, row, 1, veh, false, false); guiGridListSetItemText (g, row, 2, getElementModel (v), false, false); guiGridListSetItemData (g, row, 1, v); end end guiGridListSetSelectedItem (g, 0, 1); end ); Link to comment
fxl Posted October 24, 2022 Share Posted October 24, 2022 addEvent ("tune.sync_objects", true); addEventHandler ("tune.sync_objects", root, function (veh, objects) local g = tune.gridlist[3]; local label_text = "none" ---- set it to none by default. if isPedInVehicle(localPlayer) then --if ped is in vehicle then set labeltext to vehname label_text = getVehicleName(getPedOccupiedVehicle(localPlayer)) end tune.label[5]:setText("Você deve estar em um veículo para usar este painel.\nVeículo atual: "..label_text) if not isPedInVehicle (localPlayer) then return end if not veh or not objects then return end guiGridListClear (g); for i=#objects, 1, -1 do local v = objects[i]; if isElement (v) then local row = guiGridListAddRow (g); guiGridListSetItemText (g, row, 1, veh, false, false); guiGridListSetItemText (g, row, 2, getElementModel (v), false, false); guiGridListSetItemData (g, row, 1, v); end end guiGridListSetSelectedItem (g, 0, 1); end ); This code should work without errors. 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