JuegosPato Posted August 16, 2012 Posted August 16, 2012 Hola amigos, yo necesito este script, osea, un gui y en el gui este el nombre de un auto/vehículo y lo selecciona Ejemplo:
JuegosPato Posted August 16, 2012 Author Posted August 16, 2012 Hacelo, como lo hice yo. Que funciones utilizaste?
Castillo Posted August 16, 2012 Posted August 16, 2012 guiCreateWindow guiCreateGridList guiCreateButton guiGridListGetSelectedItem guiGridListGetItemText triggerServerEvent getVehicleModelFromName createVehicle warpPedIntoVehicle
JuegosPato Posted August 16, 2012 Author Posted August 16, 2012 guiCreateWindow guiCreateGridList guiCreateButton guiGridListGetSelectedItem guiGridListGetItemText triggerServerEvent getVehicleModelFromName createVehicle warpPedIntoVehicle Algo dificil para mi, pero lo intentare.
JuegosPato Posted August 16, 2012 Author Posted August 16, 2012 Este es el gui.Pero me complica algo con las otras funciones GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(391,195,507,430,"Vehicles",false) GUIEditor_Button[1] = guiCreateButton(0.0276,0.8186,0.3846,0.1465,"Use",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5819,0.8186,0.3846,0.1465,"Close",true,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(0.0217,0.0558,0.9546,0.7419,true,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle name:",0.2) for i = 1, 1 do guiGridListAddRow(GUIEditor_Grid[1]) end guiGridListSetItemText(GUIEditor_Grid[1],0,1,"BMX")
Tonyx97 Posted August 16, 2012 Posted August 16, 2012 Este es el gui.Pero me complica algo con las otras funciones GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(391,195,507,430,"Vehicles",false) GUIEditor_Button[1] = guiCreateButton(0.0276,0.8186,0.3846,0.1465,"Use",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5819,0.8186,0.3846,0.1465,"Close",true,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(0.0217,0.0558,0.9546,0.7419,true,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle name:",0.2) for i = 1, 1 do guiGridListAddRow(GUIEditor_Grid[1]) end guiGridListSetItemText(GUIEditor_Grid[1],0,1,"BMX") Si ese es el GUI (intentando copiar a CIT eh) pero yo no digo nada, ahora utiliza las otras funciones para crear los vehhicles
JuegosPato Posted August 16, 2012 Author Posted August 16, 2012 Este es el gui.Pero me complica algo con las otras funciones GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(391,195,507,430,"Vehicles",false) GUIEditor_Button[1] = guiCreateButton(0.0276,0.8186,0.3846,0.1465,"Use",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5819,0.8186,0.3846,0.1465,"Close",true,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(0.0217,0.0558,0.9546,0.7419,true,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle name:",0.2) for i = 1, 1 do guiGridListAddRow(GUIEditor_Grid[1]) end guiGridListSetItemText(GUIEditor_Grid[1],0,1,"BMX") Si ese es el GUI (intentando copiar a CIT eh) pero yo no digo nada, ahora utiliza las otras funciones para crear los vehhicles , No, no quiero copiar al Cit, al Saur, ni nada de eso, (Pues en realidad si), me gusto la idea de eso.Porque evita que aya más lag en el servidor. :C Me complican las funciones D:
iFoReX Posted August 16, 2012 Posted August 16, 2012 C: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(391,195,507,430,"Vehicles",false) GUIEditor_Button[1] = guiCreateButton(0.0276,0.8186,0.3846,0.1465,"Use",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5819,0.8186,0.3846,0.1465,"Close",true,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(0.0217,0.0558,0.9546,0.7419,true,GUIEditor_Window[1]) col = guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle name:",0.2) addEventHandler("onClientResourceStart",resourceRoot,function() local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1],row,col,"BMX",false,false) end )
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 C: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(391,195,507,430,"Vehicles",false) GUIEditor_Button[1] = guiCreateButton(0.0276,0.8186,0.3846,0.1465,"Use",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.5819,0.8186,0.3846,0.1465,"Close",true,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(0.0217,0.0558,0.9546,0.7419,true,GUIEditor_Window[1]) col = guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle name:",0.2) addEventHandler("onClientResourceStart",resourceRoot,function() local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1],row,col,"BMX",false,false) end ) Gracias Mota, pero ya lo solucione. El problema que tengo ahora es: -No le da el vehículo cuando lo selecciona. -Cuando vas corriendo y tocas el marker, el personaje anda corriendo con el GUI. Client: local vehicles = {"BMX", "Bike", "Mountain Bike"} local bikes = createMarker(1183.2487792969, -1314.9769287109, 12.546875, 'cylinder', 1.5, 255, 255, 255, 255) function createVehGui () 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 end addEventHandler("onClientMarkerHit", bikes, function ( hitElement ) if (hitElement == localPlayer) then createVehGui ( hitElement ) 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 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) Server function spawnBike (lol) local id = getElementModel(thevehicle) if id == 509 or id == 510 or id == 481 then local x, y, z = getElementPosition ( source ) local xr, yr, zr = getElementRotation ( source ) createVehicle = createVehicle (id, x, y, z + 0.5, xr, yr, zr ) warpPedIntoVehicle(source, createVehicle) end end addEvent( "spawnBike", true) addEventHandler("spawnBike",root,spawnBike)
iFoReX Posted August 17, 2012 Posted August 17, 2012 addEventHandler("onClientMarkerLeave", bikes, function ( leaveElement ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) si no funciona dime lo hize a la rapida
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 addEventHandler("onClientMarkerLeave", bikes, function ( leaveElement ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) si no funciona dime lo hize a la rapida No.No funcionó. No se.Creo que puse mal en la linea. Era así, no? local vehicles = {"BMX", "Bike", "Mountain Bike"} local bikes = createMarker(1183.2487792969, -1314.9769287109, 12.546875, 'cylinder', 1.5, 255, 255, 255, 255) function createVehGui () 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 end addEventHandler("onClientMarkerLeave", bikes, function ( leaveElement ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) addEventHandler("onClientGUIClick", root, function () if (source == Spawn) then 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)
iFoReX Posted August 17, 2012 Posted August 17, 2012 me equivoque en 1 argumento :3 addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) proba asi
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 me equivoque en 1 argumento :3 addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) proba asi No. No aparece el gui.
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 debugscript problem ? Dice: INFO: Votemanager precreateGuiElements
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 Dale a /restart ELNAMEDELRSOURCE Si lo hice pero nada.
Alexs Posted August 17, 2012 Posted August 17, 2012 Posees varios argumentos no definidos, revisa cada argumento y donde lo defines.
JuegosPato Posted August 17, 2012 Author Posted August 17, 2012 Posees varios argumentos no definidos, revisa cada argumento y donde lo defines. Me podes ayudar un poco.No soy un gran scripter.
Alexs Posted August 17, 2012 Posted August 17, 2012 addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) este, por ejemplo el argumento que usas se llama leftPlayer, pero tu comparas si un argumento (no definido) llamado 'leaveElement' es igual al localPlayer.
JuegosPato Posted August 19, 2012 Author Posted August 19, 2012 addEventHandler("onClientMarkerLeave", bikes, function ( leftPlayer,matchingDimension ) if (leaveElement == localPlayer) then guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) end end ) este, por ejemplo el argumento que usas se llama leftPlayer, pero tu comparas si un argumento (no definido) llamado 'leaveElement' es igual al localPlayer. Mmm. Yo solamente quería solucionar sobre el botón del "Use" porque seleccionaba a un vehículo y después tocabas el botón y no aparecía, solamente quiero ayuda en eso.
JuegosPato Posted August 19, 2012 Author Posted August 19, 2012 Client: local vehicles = {"BMX", "Bike", "Mountain Bike"} local bikes = createMarker(1183.2487792969, -1314.9769287109, 12.546875, 'cylinder', 1.5, 255, 255, 255, 255) function createVehGui () 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 end addEventHandler("onClientMarkerHit", bikes, function ( hitElement ) if (hitElement == localPlayer) then createVehGui ( hitElement ) 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 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) Server: function spawnBike (lol) local id = getElementModel(thevehicle) if id == 509 or id == 510 or id == 481 then local x, y, z = getElementPosition ( source ) local xr, yr, zr = getElementRotation ( source ) createVehicle = createVehicle (id, x, y, z + 0.5, xr, yr, zr ) warpPedIntoVehicle(source, createVehicle) end end addEvent( "spawnBike", true) addEventHandler("spawnBike",root,spawnBike)
Recommended Posts