EstrategiaGTA Posted September 10, 2013 Posted September 10, 2013 (edited) Prueba así (client) local vehicles = {"BMX", "Bike", "Mountain Bike"} local bikes = createMarker(1183.2487792969, -1314.9769287109, 12.546875, 'cylinder', 1.5, 255, 255, 255, 255) MainGui = guiCreateWindow(408,203,240,349,"Vehicle",false) VehGrid = guiCreateGridList(17,32,200,256,false,MainGui) guiGridListSetSelectionMode(VehGrid,2) _bikes = guiGridListAddColumn(VehGrid,"Vehicle name:",0.85) Spawn = guiCreateButton(15,305,96,35,"Use",false,MainGui) guiSetFont(Spawn,"clear-normal") Cancel = guiCreateButton(128,305,96,35,"Close",false,MainGui) guiSetFont(Cancel,"clear-normal") for index, vehicle in ipairs ( vehicles ) do local row = guiGridListAddRow ( VehGrid ) guiGridListSetItemText ( VehGrid, row, _bikes, tostring ( vehicle ), false, false ) end guiSetVisible(MainGui, false) addEventHandler("onClientMarkerHit", bikes, function ( hitElement ) if (hitElement == localPlayer) then if (MainGui ~= nil) then if not isPedInVehicle(localPlayer) then guiSetVisible(MainGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("Error: Please Re-enter in the marker to get your vehicle.", 255, 0, 0) end end end end ) addEventHandler("onClientGUIClick", root, function () if (source == Spawn) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) local row,col = guiGridListGetSelectedItem(VehGrid) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(VehGrid, row, 1) if vehicleName then triggerServerEvent("spawnBike",localPlayer,vehicleName) end else outputChatBox("Erro: Please select a vehicle from the list.",255,0,0) end elseif (source == Cancel) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) addEventHandler("onClientPlayerWasted", root, function () guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end) Edited September 10, 2013 by Guest
Castillo Posted September 10, 2013 Posted September 10, 2013 local vehicles = {"BMX", "Bike", "Mountain Bike"} local bikes = createMarker(1183.2487792969, -1314.9769287109, 12.546875, 'cylinder', 1.5, 255, 255, 255, 255) MainGui = guiCreateWindow(408,203,240,349,"Vehicle",false) VehGrid = guiCreateGridList(17,32,200,256,false,MainGui) guiGridListSetSelectionMode(VehGrid,2) _bikes = guiGridListAddColumn(VehGrid,"Vehicle name:",0.85) Spawn = guiCreateButton(15,305,96,35,"Use",false,MainGui) guiSetFont(Spawn,"clear-normal") Cancel = guiCreateButton(128,305,96,35,"Close",false,MainGui) guiSetFont(Cancel,"clear-normal") for index, vehicle in ipairs ( vehicles ) do local row = guiGridListAddRow ( VehGrid ) guiGridListSetItemText ( VehGrid, row, _bikes, tostring ( vehicle ), false, false ) end guiSetVisible(MainGui, false) addEventHandler("onClientMarkerHit", bikes, function ( hitElement ) if (hitElement == localPlayer) then if isPedInVehicle ( localPlayer ) then return end if (MainGui ~= nil) then guiSetVisible(MainGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("Error: Please Re-enter in the marker to get your vehicle.", 255, 0, 0) end end end ) addEventHandler("onClientGUIClick", root, function () if (source == Spawn) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) local row,col = guiGridListGetSelectedItem(VehGrid) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(VehGrid, row, 1) if vehicleName then triggerServerEvent("spawnBike",localPlayer,vehicleName) end else outputChatBox("Erro: Please select a vehicle from the list.",255,0,0) end elseif (source == Cancel) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) addEventHandler("onClientPlayerWasted", root, function () guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end)
JuegosPato Posted September 10, 2013 Author Posted September 10, 2013 EstrategiaGTA lo tuyo no funciono , pero el de SolidSnake si Gracias a todos igual
JuegosPato Posted September 10, 2013 Author Posted September 10, 2013 Ahora tengo otro problema D:, cuando vas corriendo y tocas el marker te aparece el GUI y si sigues corriendo te sigue apareciendo el GUI D: Me pueden arreglar esto?? puse cosas mal definidas D:, me lo pueden arreglar? D: addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end )
EstrategiaGTA Posted September 10, 2013 Posted September 10, 2013 (edited) ¿Te refieres que cuando salgas del marker se te quite el GUI? Prueba así addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leftPlayer == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) Edited September 10, 2013 by Guest
Castillo Posted September 10, 2013 Posted September 10, 2013 addEventHandler ( "onClientMarkerLeave", bikes, function ( leaveElement, matchingDimension ) if ( leaveElement == localPlayer ) then guiSetVisible ( MainGui, false ) showCursor ( false ) guiSetInputEnabled ( false ) end end ) Estabas usando dos variables: leftPlayer y leaveElement.
JuegosPato Posted September 11, 2013 Author Posted September 11, 2013 addEventHandler ( "onClientMarkerLeave", bikes, function ( leaveElement, matchingDimension ) if ( leaveElement == localPlayer ) then guiSetVisible ( MainGui, false ) showCursor ( false ) guiSetInputEnabled ( false ) end end ) Estabas usando dos variables: leftPlayer y leaveElement. Tengo un nuevo problema! -Como ago para que el GUI es exclusivamente para un clan/team? -Si pasas con el JetPack desde arriba del marker desde una altura muy alta aparece el GUI
EstrategiaGTA Posted September 11, 2013 Posted September 11, 2013 Para lo del jetpack, ¿te refieres que quieres que el GUI solo se abra si estás en una coordenada Z concreta? Y para solo para un team, usa: local elteam = getPlayerTeam(localPlayer) if getTeamName(elteam) == "El Team" then
Castillo Posted September 11, 2013 Posted September 11, 2013 El problema de que se habra a una altura indefinida es un bug del MTA con los markers client side, si lo creas server side, el problema no existira.
JuegosPato Posted September 11, 2013 Author Posted September 11, 2013 Para lo del jetpack, ¿te refieres que quieres que el GUI solo se abra si estás en una coordenada Z concreta? Y para solo para un team, usa: local elteam = getPlayerTeam(localPlayer) if getTeamName(elteam) == "El Team" then Gracias me Funciono sobre el Team !! Segun SolidSnake14 dice que es un bug del MTA, Si tu me das las funciones de como hacer eso yo lo aria... El problema de que se habra a una altura indefinida es un bug del MTA con los markers client side, si lo creas server side, el problema no existira. Como ago para arreglar ese bug ?
Recommended Posts