Jump to content

JuegosPato

Members
  • Posts

    69
  • Joined

  • Last visited

Posts posted by JuegosPato

  1. 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 :D sobre el Team !!

    Segun SolidSnake14 dice que es un bug del MTA, :S 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 ?

  2. 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

  3. 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 
    ) 
    

  4. 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 
    

    :D 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) 
    

  5. 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.

  6. 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]

  7. 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:

    130910015158238444.jpg

    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 
    

  8. Donde está el onClientMarkerHit o como haces aparecer el gui

    Ya puse el

    Ya le puse :D, 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) 
    

  9. 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) 
    

  10. 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 :S

    (No agan caso sobre el getElementModel, era otro resource.)

    130909054102583948.png

  11. Hola amigos, tengo un problema con la funcion "createPed", porque cuando creo un ped, siempre lo matan, se queda tirado al piso, como puedo solucionar eso.Solamente par aque nadie lo mate.

  12. 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...

×
×
  • Create New...