Ramyxfa Posted September 9, 2015 Posted September 9, 2015 WARNING: CITtransport/transports.lua:149: Bad argument @ 'addEventHan dler' [Expected element at argument 2, got nil] any help here is my script : local tansports = {} local resX, resY = guiGetScreenSize() function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end function makeGUI() win = guiCreateWindow(383, 229, 516, 440, "Rapid Transportation System", false) guiWindowSetSizable(win, false) guiSetAlpha(win, 0.91) guiSetVisible(win, false) centerWindow(win) lab1 = guiCreateLabel(18, 28, 249, 20, "Select a location to be transported to:", false, win) guiSetFont(lab1, "clear-normal") lab2 = guiCreateLabel(23, 392, 279, 31, "The cost of travel is based on the distance between you and the location.", false, win) guiLabelSetHorizontalAlign(lab2, "left", true) butTravel = guiCreateButton(305, 392, 88, 36, "Travel", false, win) guiSetProperty(butTravel, "NormalTextColour", "FFAAFFAA") addEventHandler("onClientGUIClick", butTravel, travelToDest, false) butClose = guiCreateButton(408, 392, 88, 36, "Close", false, win) guiSetProperty(butClose, "NormalTextColour", "FFFFAAAA") addEventHandler("onClientGUIClick", butClose, closeGUI, false) end addEventHandler("onClientResourceStart", resourceRoot, makeGUI) function openGUI(locs) showCursor(true) guiSetVisible(win, true) guiBringToFront(win) grid = guiCreateGridList(18, 58, 478, 324, false, win) guiGridListAddColumn(grid, "Location", 0.65) guiGridListAddColumn(grid, "Cost of Travel", 0.25) local money = getPlayerMoney() for i, loc in ipairs(locs) do local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, loc[1], false, false) guiGridListSetItemText(grid, row, 2, "$"..loc[2], false, false) if (loc[2] > money) then guiGridListSetItemColor(grid, row, 2, 255, 0, 0) end end end addEvent("CITtransport.gui", true) addEventHandler("CITtransport.gui", root, openGUI) function closeGUI() showCursor(false) destroyElement(grid) guiSetVisible(win, false) end function travelToDest() local destName = guiGridListGetItemText(grid, guiGridListGetSelectedItem(grid), 1) if (not destName) then return end triggerServerEvent("CITtransport.travel", root, destName) closeGUI() end
JR10 Posted September 9, 2015 Posted September 9, 2015 We don't offer help with stolen/leaked scripts.
Recommended Posts