Jump to content

Como hacer esto.


JuegosPato

Recommended Posts

Posted

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:

scaled.php?server=688&filename=mtascreen20120815221325.png&res=landing

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted

Hacelo, como lo hice yo.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Hacelo, como lo hice yo.

Que funciones utilizaste?

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
guiCreateWindow 
guiCreateGridList 
guiCreateButton 
guiGridListGetSelectedItem 
guiGridListGetItemText 
triggerServerEvent 
getVehicleModelFromName 
createVehicle 
warpPedIntoVehicle 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
guiCreateWindow 
guiCreateGridList 
guiCreateButton 
guiGridListGetSelectedItem 
guiGridListGetItemText 
triggerServerEvent 
getVehicleModelFromName 
createVehicle 
warpPedIntoVehicle 

Algo dificil para mi, pero lo intentare.

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted

Este es el gui.Pero me complica algo con las otras funciones :S

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") 

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
Este es el gui.Pero me complica algo con las otras funciones :S
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) xD pero yo no digo nada, ahora utiliza las otras funciones para crear los vehhicles :)

-Advanced programmer C++, openGL, JS, Java y C# 

me :)

Posted
Este es el gui.Pero me complica algo con las otras funciones :S
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) xD pero yo no digo nada, ahora utiliza las otras funciones para crear los vehhicles :)

xD, 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:

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted

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 
) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
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) 
  

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
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 :P

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
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 :P

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) 

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted

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

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
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.

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
debugscript problem ?

Dice:

INFO: Votemanager precreateGuiElements

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
Dale a /restart ELNAMEDELRSOURCE

:S Si lo hice pero nada.

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted
Posees varios argumentos no definidos, revisa cada argumento y donde lo defines.

Me podes ayudar un poco.No soy un gran scripter.

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

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

Developer @ MYVAL

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

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

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

Posted

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) 

My nickname is: Pato

I am a good mapper, an apprentice in scripting and a talented in photoshop.

Scripting & Mapping server -bmx-

430x73.png

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...