-
Posts
69 -
Joined
-
Last visited
Posts posted by JuegosPato
-
-
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
-
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 )
-
-
Solo te arregló el script, él te dijo esas funciones para:
guiSetVisible --Así harás que cuando seleccione el vehículo y le de click al button, se cierre el GUI isPedInVehicle --Dijiste que no quieres hacer aparecer el GUI cuando están en un vehículo. Con eso haz que si el jugador está en un vehículo, no se abra el GUI. destroyElement --Para destruir el vehículo, supongo
Ya puse la funcion de 'destroyElement' y la de 'guiSetVisible', lo que no me se es 'isPedInVehicle' D:
Cuando tengas un vehiculo y vas al marker que no se habra el GUI.
Server side.
addEvent ( 'spawnBike', true ) addEventHandler ( "spawnBike", getRootElement(), function ( cars ) if isElement ( veh ) then destroyElement ( veh ) end local cn = getVehicleModelFromName ( cars ) local x,y,z = getElementPosition ( source ) local cn2 = getVehicleNameFromModel ( cn ) veh = createVehicle ( cn, x, y, z ) warpPedIntoVehicle ( source, veh ) end )
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 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)
-
-
addEvent ( 'spawnBike', true ) addEventHandler ( 'spawnBike', root, function ( model ) id = getVehicleModelFromName( model ) local off = createVehicle ( id, 1183.2487792969, -1314.9769287109, 14.546875, 0, 0, 270 ) setTimer( warpPedIntoVehicle, 100, 1, source, off ) end )
Errores nuevos:
-Cuando selecciona un Vehiculo y toca el boton "use", te da el coche, pero, no se te cierra el GUI.
-Usas un coche y vas por el marker se te habre el GUI.
-Podes poner muchos vehiculos y se te bugea todo.
-
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 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)
Ahora si aparecen los vehiculos, pero, cuando selecciono y toco en "Use" no me da el coche.
/debuscript 3:
WARNING: tdb/server.lua:2: Bad argument @ 'getElementModel' [Expected element at argument 1, go nil]
-
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 end local row = guiGridListAddRow (VehGrid) guiGridListSetItemText ( VehGrid, row, _bikes, tostring(vehicle), false, false ) guiSetVisible(MainGui, false) ---------------------------------------------------------------------------------------------------------------- addEventHandler("onClientMarkerHit", bikes, function ( hitElement ) if (hitElement == localPlayer) then 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)
Ahora esta el GUI, pero los nuevos errores son que no estan los vehiculos y tengo un error con el getElementModel D:
Imagen:
Por si acaso, aqui les dejo el Server.
function spawnBike () 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 ) bike = createVehicle (id, x, y, z + 0.5, xr, yr, zr ) warpPedIntoVehicle(source, bike) end end addEvent( "spawnBike", true) addEventHandler("spawnBike",root,spa
-
Donde está el onClientMarkerHit o como haces aparecer el gui
Ya puse el
Ya le puse , pero, ahora me da error, no aparece el gui igual
Esto es lo que aparece:
ERROR:tdb-xd/client.lua21:attempt to call global 'createVehGui' (a nill value)
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 end local row = guiGridListAddRow (VehGrid) guiGridListSetItemText ( VehGrid, row, _bikes, tostring(vehicle), false, false ) guiSetVisible(MainGui, false) ---------------------------------------------------------------------------------------------------------------- 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)
-
Postea todo client y server.
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 ) guiSetVisible(MainGui, false) --Reemplace la función que tenias por esto. 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)
Server.
function spawnBike () 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 ) bike = createVehicle (id, x, y, z + 0.5, xr, yr, zr ) warpPedIntoVehicle(source, bike) end end addEvent( "spawnBike", true) addEventHandler("spawnBike",root,spawnBike)
-
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 ) guiSetVisible(MainGui, false) --Reemplace la función que tenias por esto. 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)
PD: Acá no veo cuando muestras el GUi de creación.
Me dice que tengo un error en la Linea 12
(No agan caso sobre el getElementModel, era otro resource.)
-
No seria mejor hacer un car spawn??, osea un marker y cuando lo tocas el marker te aparesca un gui para seleccionar una lista de coches, pero exclusivo para un team
-
tu quieres que el objeto este en movimiento constante o que se mueva y se detenga unos 3 segundos y se vuelva a mover?
Me da igual, con tal que se mueva
-
Como hago un scripts para que tenga los coches de una base exclusivo para un clan/team y que nadie lo pueda robar, destruir, etc...
-
Hay un objeto llamado "info" y quiero que de vuelta siempre sin moverde de un lado, al otro, que de la vuelta siempre.
Como lo ago?
-
Podrias poner un ped ( createPed ) dentro del vehiculo y usar:
setPedControlState
No entiendo mucho, si entiendo lo del 'createPed', pero el 'setPedControlState' no mucho.
-
Queres que un vehiculo se mueva sin un jugador?
Sí.
-
Podes usar mi recurso:
Como se lo usa??, porque no entendi nada.!
-
Hola amigos, tengo otra duda, yo toy haciendo un map de race, esta basado en una ciudad tropical, yo lo que quiero como hacer un vehiculo y que se mueva sola.Osea, un vehiculo cualquiera se mueva solo.
-
-
Hola amigos, yo quiero saber como crear un wanted, osea, cuando un criminal hace un robo, mata o hace una accion mala, le aparesca una estrella arriba y en el hud dice cuantas estrellas son, y el otro script que la Policia atrape a ellos solamente, a los que tienen la estrella, algo tipo Saur...
-
Ya lo use.Pero necesito saber como crear un marker en un interior.
-
Si me anda!!Anda re bien pero el otro problema como ago un marker en un interiror?
-
Tienes un error en el elemento de setElementInterior. (un error tonto )
hitPlayer
HitPlayer
Lol.Osea lo cambio el "HitPlayer" por hitPlayer.
Problema
in Scripting
Posted
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...
Como ago para arreglar ese bug ?