Jump to content

why not works?


Gallagher

Recommended Posts

which the error

original works ↓↓

local headline = {} 
local gridlistItems = {} 
local buttonItems = {} 
Inventario = {} 
  
  
inventoryWindows = guiCreateWindow(0.15, 0.28, 0.72, 0.63, "", true) -- [iD:0000014 - Remodel Inventory] //L 
-- inventoryWindows = guiCreateStaticImage(0.25,0.25,0.5,0.5,"images/scrollmenu_1.png",true) -- [iD:0000014 - Remodel Inventory] //L 
  
  
headline["loot"] = guiCreateLabel(0.06, 0.05, 0.34, 0.09,"GEAR",true,inventoryWindows) 
guiLabelSetHorizontalAlign (headline["loot"],"center") 
guiSetFont (headline["loot"], "default-bold-small" ) 
  
headline["inventory"] = guiCreateLabel(0.60, 0.05, 0.34, 0.09,"INVENTORY",true,inventoryWindows) 
guiLabelSetHorizontalAlign (headline["inventory"],"center") 
guiSetFont (headline["inventory"], "default-bold-small" ) 
Inventario[1] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/inventory.png",true,inventoryWindows) 
guiSetAlpha(Inventario[1],1) 
guiSetProperty(Inventario[1],"Disabled","true") 
  
gridlistItems["loot"] = guiCreateGridList (0.03, 0.10, 0.39, 0.83,true,inventoryWindows) 
gridlistItems["loot_colum"] = guiGridListAddColumn( gridlistItems["loot"], "Loot", 0.7 ) 
gridlistItems["loot_colum_amount"] = guiGridListAddColumn( gridlistItems["loot"], "", 0.2 ) 
  
gridlistItems["inventory"] = guiCreateGridList (0.57, 0.11, 0.39, 0.83,true,inventoryWindows) 
gridlistItems["inventory_colum"] = guiGridListAddColumn( gridlistItems["inventory"], "Inventory", 0.7 ) 
gridlistItems["inventory_colum_amount"] = guiGridListAddColumn( gridlistItems["inventory"], "", 0.2 ) 
  
buttonItems["loot"] = guiCreateButton(0.42, 0.17, 0.04, 0.69, "->", true,inventoryWindows) 
buttonItems["inventory"] = guiCreateButton(0.53, 0.17, 0.04, 0.69, "<-", true,inventoryWindows) 
  
headline["slots"] = guiCreateLabel(0.62, 0.94, 0.29, 0.04,"SLOTS:",true,inventoryWindows) 
guiLabelSetHorizontalAlign (headline["slots"],"center") 
guiLabelSetVerticalAlign (headline["slots"],"center") 
guiSetFont (headline["slots"], "default-bold-small" ) 
  
headline["slots_loot"] = guiCreateLabel(0.07, 0.94, 0.29, 0.04,"SLOTS:",true,inventoryWindows) 
guiLabelSetHorizontalAlign (headline["slots_loot"],"center") 
guiLabelSetVerticalAlign (headline["slots_loot"],"center") 
guiSetFont (headline["slots_loot"], "default-bold-small" ) 
  
guiSetVisible(inventoryWindows,false) 
  
function showInventory (key,keyState) 
if getElementData(getLocalPlayer(),"logedin") then 
    if ( keyState == "down" ) then 
        guiSetVisible(inventoryWindows,not guiGetVisible(inventoryWindows)) 
        showCursor(not isCursorShowing()) 
        refreshInventory() 
        if guiGetVisible(inventoryWindows) == true then 
            onClientOpenInventoryStopMenu () 
        else 
            hideRightClickInventoryMenu () 
        end 
        if isPlayerInLoot() then 
            local col = getElementData(getLocalPlayer(),"currentCol") 
            local gearName = getElementData(getLocalPlayer(),"lootname") 
            refreshLoot(col,gearName) 
        end 
    end 
end  
end 
bindKey ( "j", "down", showInventory ) 

edited does not work↓↓

local headline = {} 
local gridlistItems = {} 
local buttonItems = {} 
local Inventario = {} 
  
inventoryWindows = guiCreateWindow(0.15, 0.28, 0.72, 0.63, "", true) 
headline.loot = guiCreateLabel(0.06, 0.05, 0.34, 0.09, "GEAR", true, inventoryWindows) 
guiLabelSetHorizontalAlign(headline.loot, "center") 
guiSetFont(headline.loot, "default-bold-small") 
  
headline.inventory = guiCreateLabel(0.6, 0.05, 0.34, 0.09, "INVENTÁRIO", true, inventoryWindows) 
guiLabelSetHorizontalAlign(headline.inventory, "center") 
guiSetFont(headline.inventory, "default-bold-small") 
 if getElementData(getLocalPlayer(), "Pizza") < 1 then 
Inventario[1] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/pp.png",true,inventoryWindows) 
guiSetAlpha(Inventario[1],0.-- s8) -->
guiSetProperty(Inventario[1],"Disabled","true") then 
else getElementData(getLocalPlayer(), "Pizza") == 1 then 
Inventario[2] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/p1.png",true,inventoryWindows) 
guiSetAlpha(Inventario[2],1) 
guiSetProperty(Inventario[2],"Disabled","true") 
else getElementData(getLocalPlayer(), "Pizza") == 2 then 
Inventario[3] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/p2.png",true,inventoryWindows) 
guiSetAlpha(Inventario[3],1) 
guiSetProperty(Inventario[3],"Disabled","true") 
function showInventory(key, keyState) 
if getElementData(getLocalPlayer(), "logedin") and keyState == "down" then 
    guiSetVisible(inventoryWindows, not guiGetVisible(inventoryWindows)) 
    showCursor(not isCursorShowing()) 
    refreshInventory() 
    if guiGetVisible(inventoryWindows) == true then 
      onClientOpenInventoryStopMenu() 
    else 
      hideRightClickInventoryMenu() 
    end 
    if isPlayerInLoot() then 
      local col = getElementData(getLocalPlayer(), "currentCol") 
      local gearName = getElementData(getLocalPlayer(), "lootname") 
      refreshLoot(col, gearName) 
    end 
end 
end 
bindKey("j", "down", showInventory) 

Link to comment
  • Moderators

Hi, try this:

local headline = {} 
local gridlistItems = {} 
local buttonItems = {} 
local Inventario = {} 
  
inventoryWindows = guiCreateWindow(0.15, 0.28, 0.72, 0.63, "", true) 
headline.loot = guiCreateLabel(0.06, 0.05, 0.34, 0.09, "GEAR", true, inventoryWindows) 
guiLabelSetHorizontalAlign(headline.loot, "center") 
guiSetFont(headline.loot, "default-bold-small") 
  
headline.inventory = guiCreateLabel(0.6, 0.05, 0.34, 0.09, "INVENTÁRIO", true, inventoryWindows) 
guiLabelSetHorizontalAlign(headline.inventory, "center") 
guiSetFont(headline.inventory, "default-bold-small") 
  
if getElementData(getLocalPlayer(), "Pizza") < 1 then 
  Inventario[1] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/pp.png",true,inventoryWindows) 
  guiSetAlpha(Inventario[1],0.-- s8) -->
  guiSetProperty(Inventario[1],"Disabled","true") then 
elseif getElementData(getLocalPlayer(), "Pizza") == 1 then 
  Inventario[2] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/p1.png",true,inventoryWindows) 
  guiSetAlpha(Inventario[2],1) 
  guiSetProperty(Inventario[2],"Disabled","true") 
elseif getElementData(getLocalPlayer(), "Pizza") == 2 then 
  Inventario[3] = guiCreateStaticImage(0.01, 0.03, 1.99, 100, "images/p2.png",true,inventoryWindows) 
  guiSetAlpha(Inventario[3],1) 
  guiSetProperty(Inventario[3],"Disabled","true") 
end 
guiSetVisible(inventoryWindows,false) 
  
function showInventory(key, keyState) 
  if getElementData(getLocalPlayer(), "logedin") and keyState == "down" then 
    guiSetVisible(inventoryWindows, not guiGetVisible(inventoryWindows)) 
    showCursor(not isCursorShowing()) 
    refreshInventory() 
    if guiGetVisible(inventoryWindows) == true then 
      onClientOpenInventoryStopMenu() 
    else 
      hideRightClickInventoryMenu() 
    end 
    if isPlayerInLoot() then 
      local col = getElementData(getLocalPlayer(), "currentCol") 
      local gearName = getElementData(getLocalPlayer(), "lootname") 
      refreshLoot(col, gearName) 
    end 
  end 
end 
bindKey("j", "down", showInventory) 

Tips:

- Learn Lua 1st (it's: "elseif condition here then" and not "else condition here then", and an if else statement must end with the "end" keyword).

- Look at the client logs to check errors (/debugscript 3 if logged as admin, check acl.xml).

- Learn to properly indent your code.

- Stealing code, won't make u better but reading and understanding do.

Note:

This code won't trow errors if the following functions are defined and working somewhere in your code:

- refreshInventory()

- onClientOpenInventoryStopMenu()

- hideRightClickInventoryMenu()

- isPlayerInLoot()

- refreshLoot(arg1, arg2)

Regards,

Citizen

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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