Jump to content

Como se puede?


Plate

Recommended Posts

Posted

Hola tengo una duda como se puede obtener todas las armas que tiene un jugador y ponerlas en una gridlist?

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Usa un for-loop con:

getPedWeapon 
guiGridListAddRow 
guiGridListSetItemText 

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

Me parece que hize cualquier cosa

function armas() 
local weapons = getPedWeapon(source) 
for _,weapons in ipairs(weapons) 
local row = guiGridListAddRow ( lista ) 
 guiGridListSetItemText ( lista, row, armas, weapons, false, false ) 
end 
end 

o capas que

function armas() 
for _,weapons in ipairs(getPedWeapon(source)) 
local row = guiGridListAddRow ( lista ) 
 guiGridListSetItemText ( lista, row, armas, weapons, false, false ) 
end 
end 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Si, me temo que hiciste cualquier cosa.

function armas ( ) 
    for slot = 0, 12 do 
        local weapon = getPedWeapon ( localPlayer, slot ) 
        if ( weapon > 0 ) then 
            local row = guiGridListAddRow ( lista ) 
            guiGridListSetItemText ( lista, row, armas, getWeaponNameFromID ( weapon ), false, false ) 
        end 
    end 
end 

getPedWeapon no es una tabla, devuelve un arma, el for-loop era de 0 a 12 ( el slot ).

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

Postea todo el script.

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
GUIEditor_TabPanel = {} 
  
GUIEditor_TabPanel[1] = guiCreateTabPanel(315,183,290,299,false) 
Tab_Armas = guiCreateTab("Armas",GUIEditor_TabPanel[1]) 
lista = guiCreateGridList(38,36,208,187,false,Tab_Armas) 
guiGridListSetSelectionMode(lista,2) 
  
armas = guiGridListAddColumn(lista,"Armas",0.6) 
  
guiGridListAddColumn(lista,"Municion",0.5) 
equipar = guiCreateButton(36,229,65,25,"Equipar",false,Tab_Armas) 
Tirar = guiCreateButton(149,230,65,25,"Tirar",false,Tab_Armas) 
Tab_Medicinas = guiCreateTab("Medicinas",GUIEditor_TabPanel[1]) 
Grid_Medicina = guiCreateGridList(34,21,218,185,false,Tab_Medicinas) 
guiGridListSetSelectionMode(Grid_Medicina,2) 
  
guiGridListAddColumn(Grid_Medicina,"Medicinas",0.2) 
Usar = guiCreateButton(33,222,74,26,"Usar",false,Tab_Medicinas) 
tirar_medicina = guiCreateButton(139,222,74,26,"Tirar",false,Tab_Medicinas) 
  
  
  
guiSetVisible(GUIEditor_TabPanel[1], false) 
function ver() 
guiSetVisible(GUIEditor_TabPanel[1], true) 
showCursor(true) 
end 
addCommandHandler("prueva",ver) 
function lol() 
guiSetVisible(GUIEditor_TabPanel[1], false) 
showcursor(false) 
end 
addCommandHandler("prueva2",lol) 
function armas ( ) 
    for slot = 0, 12 do 
        local weapon = getPedWeapon ( localPlayer, slot ) 
        if ( weapon > 0 ) then 
            local row = guiGridListAddRow ( lista ) 
            guiGridListSetItemText ( lista, row, armas, getWeaponNameFromID ( weapon ), false, false ) 
        end 
    end 
end 
  

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
GUIEditor_TabPanel = {} 
  
GUIEditor_TabPanel[1] = guiCreateTabPanel(315,183,290,299,false) 
Tab_Armas = guiCreateTab("Armas",GUIEditor_TabPanel[1]) 
lista = guiCreateGridList(38,36,208,187,false,Tab_Armas) 
guiGridListSetSelectionMode(lista,2)  
guiGridListAddColumn(lista,"Armas",0.6) 
  
guiGridListAddColumn(lista,"Municion",0.5) 
equipar = guiCreateButton(36,229,65,25,"Equipar",false,Tab_Armas) 
Tirar = guiCreateButton(149,230,65,25,"Tirar",false,Tab_Armas) 
Tab_Medicinas = guiCreateTab("Medicinas",GUIEditor_TabPanel[1]) 
Grid_Medicina = guiCreateGridList(34,21,218,185,false,Tab_Medicinas) 
guiGridListSetSelectionMode(Grid_Medicina,2) 
  
guiGridListAddColumn(Grid_Medicina,"Medicinas",0.2) 
Usar = guiCreateButton(33,222,74,26,"Usar",false,Tab_Medicinas) 
tirar_medicina = guiCreateButton(139,222,74,26,"Tirar",false,Tab_Medicinas) 
  
guiSetVisible(GUIEditor_TabPanel[1], false) 
  
function ver() 
    guiSetVisible(GUIEditor_TabPanel[1], true) 
    showCursor(true) 
    armas ( ) 
end 
addCommandHandler("prueba",ver) 
  
function lol() 
    guiSetVisible(GUIEditor_TabPanel[1], false) 
    showCursor(false) 
end 
addCommandHandler("prueba2",lol) 
  
function armas ( ) 
    for slot = 0, 12 do 
        local weapon = getPedWeapon ( localPlayer, slot ) 
        if ( weapon > 0 ) then 
            local row = guiGridListAddRow ( lista ) 
            guiGridListSetItemText ( lista, row, 1, getWeaponNameFromID ( weapon ), false, false ) 
        end 
    end 
end 

No estabas ejecutando "armas" en ninguna parte, ademas de haber llamado a una variable "armas" igual que la funcion.

P.D: Es "prueba" no "prueva".

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

Gracias solid pero si yo pongo un suponer /prueba /prueba /prueba (muchas veces) empiesa a aparecer muchas veces el arma que tengo equipada en la gridlist

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Antes del for-loop pone:

guiGridListClear ( lista  ) 

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

Y como puedo poner la municion de cada arma que tiene el usuario y que cuando toque el boton "equipar" se le cambie a esa arma

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
Y como puedo poner la municion de cada arma que tiene el usuario y que cuando toque el boton "equipar" se le cambie a esa arma
getPedTotalAmmo 

Lee los argumentos, no es una tabla.

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

Hace como 2 horas que estoy probando y me sale siempre lo mismo

Bad Argument setPedWeaponSlot y getSlotFromWeapon

function setweapon() 
local ID = getSlotFromWeapon(name) 
setPedWeaponSlot(source, ID) 
end 
addEventHandler("onClientGUIClick", equipar, setweapon, false) 
  

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

  • MTA Team
Posted

Te da mal xq usas source...Usa localplayer

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
function setweapon() 
local ID = getSlotFromWeapon() 
setPedWeaponSlot(localPlayer, ID) 
end 
addEventHandler("onClientGUIClick", equipar, setweapon, false) 

y tambien probe con

function setweapon() 
local name = getWeaponNameFromID() 
local ID = getSlotFromWeapon(name) 
setPedWeaponSlot(localPlayer, ID) 
end 
addEventHandler("onClientGUIClick", equipar, setweapon, false) 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

  • Recently Browsing   0 members

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