Sorry for not investigating this tutorial that thoughly but you have to add the code inside the vehSelection function. Otherwise it does not work because the GUI has not been created yet.
-- Put createVehicleHandler here.
-- Put populateGridlist here
-- Etc.
function vehSelection()
vehList = guiCreateWindow(0.06, 0.33, 0.31, 0.30, "Vehiculos", true)
guiWindowSetSizable(vehList, false)
botonCrear = guiCreateButton(149, 260, 101, 31, "Crear", false, vehList)
lista = guiCreateGridList(0.06, 0.12, 0.87, 0.69, true, vehList)
guiGridListAddColumn(lista, "Coches", 0.9)
guiSetVisible(vehList,false)
populateGridlist()
addEventHandler("onClientGUIClick",botonCrear,createVehicleHandler,false)
end
-- Etc.
Explanation: if you put code inside the onClientResourceStart event handler then the code is called after all scripts have been loaded/executed. This is useful if you want to wait until MTA has loaded all custom resource functions into _G before starting your code. Putting code into the event handler is not a requirement but a recommendation.