Jump to content

Blocking is not the appropriate buttons.


Guest Guest26901

Recommended Posts

Hello !

How to block buttons, which required number of points is greater than the number of points a player ?

  
local towary = { 
                {"Odpady", "Trociny", 0, 100, 250}, 
                {"Odpady", "Puszki", 1, 200, 400}, 
                {"Odpady", "Butelki", 2, 400, 550} 
               } 
  
local towar = { } 
local kupuj = { } 
  
local x,y = guiGetScreenSize() 
  
function closegui() 
    guiSetVisible(oknotow, false) 
    showCursor(false) 
end 
  
oknotow = guiCreateWindow((x-500)/2,(y-350)/2,500,350,"System towarów",false) 
guiSetVisible ( oknotow, false ) 
info1 = guiCreateLabel (0.06,0.08,0.7,0.3,"Towar", true, oknotow) 
info2 = guiCreateLabel (0.22,0.08,0.7,0.3,"Ilość score", true, oknotow) 
info3 = guiCreateLabel (0.45,0.08,0.7,0.3,"Min. suma", true, oknotow) 
info4 = guiCreateLabel (0.67,0.08,0.7,0.3,"Max. suma", true, oknotow) 
    guiSetFont ( info1, "default-bold-small" ) 
    guiSetFont ( info2, "default-bold-small" ) 
    guiSetFont ( info3, "default-bold-small" ) 
    guiSetFont ( info4, "default-bold-small" ) 
for k, v in ipairs ( towary ) do 
    function zakup () 
        if source == kupuj[k]  then 
            outputChatBox ( "Zaladowales towar o id " .. k, source) 
        end 
    end 
    towar[1] = guiCreateLabel (0.03,0.1+0.08*k,0.2,0.1,v[2],true,oknotow) 
    towar[2] = guiCreateLabel (0.27,0.1+0.08*k,0.2,0.1,v[3],true,oknotow) 
    towar[3] = guiCreateLabel (0.46,0.1+0.08*k,0.2,0.1,v[4].."$",true,oknotow) 
    towar[4] = guiCreateLabel (0.68,0.1+0.08*k,0.2,0.1,v[5].."$",true,oknotow) 
    kupuj[k] = guiCreateButton (0.83,0.095+0.08*k,0.13,0.06,"Załaduj",true,oknotow) 
        addEventHandler ( "onClientGUIClick", kupuj[k], zakup, false ) 
end 
zamknij = guiCreateButton (0.45,0.9,0.15,0.07,"Zamknij",true,oknotow) 
    addEventHandler ( "onClientGUIClick", zamknij, closegui ) 
  

Sorry, for bad english !

Link to comment

Yes, i know, but how to block not the appropriate buttons.

Towar1 = 1 points

Towar2 = 3 points

Towar3 = 10 points

Player = 4 points

If player will have 4 points, he/she can see only buttons Towar1 and Towar2 !

Link to comment
  
local towary = { 
                {"Odpady", "Trociny", 0, 100, 250}, 
                {"Odpady", "Puszki", 1, 200, 400}, 
                {"Odpady", "Butelki", 2, 400, 550} 
               } 
  

Odpady = category e.g.: Trociny = towar e.g.: 0 = minimum points e.g.: 100 = minimum prize e.g.: 250 = maximum prize

Edit: I have not yet made ​​the player points.

Edited by Guest
Link to comment
local towary = 
    { 
        { "Odpady", "Trociny", 0, 100, 250 }, 
        { "Odpady", "Puszki", 1, 200, 400 }, 
        { "Odpady", "Butelki", 2, 400, 550 } 
    } 
  
local towar = { } 
local kupuj = { } 
  
local x,y = guiGetScreenSize ( ) 
local playerPoints = 1 
  
function closegui ( ) 
    guiSetVisible ( oknotow, false ) 
    showCursor ( false ) 
end 
  
function zakup ( ) 
    for k, v in ipairs ( towary ) do 
        if ( source == kupuj [ k ] ) then 
            outputChatBox ( "Zaladowales towar o id ".. k ) 
        end 
    end 
end 
  
oknotow = guiCreateWindow((x-500)/2,(y-350)/2,500,350,"System towarów",false) 
guiSetVisible ( oknotow, false ) 
info1 = guiCreateLabel (0.06,0.08,0.7,0.3,"Towar", true, oknotow) 
info2 = guiCreateLabel (0.22,0.08,0.7,0.3,"Ilosc score", true, oknotow) 
info3 = guiCreateLabel (0.45,0.08,0.7,0.3,"Min. suma", true, oknotow) 
info4 = guiCreateLabel (0.67,0.08,0.7,0.3,"Max. suma", true, oknotow) 
guiSetFont ( info1, "default-bold-small" ) 
guiSetFont ( info2, "default-bold-small" ) 
guiSetFont ( info3, "default-bold-small" ) 
guiSetFont ( info4, "default-bold-small" ) 
for k, v in ipairs ( towary ) do 
    towar[1] = guiCreateLabel (0.03,0.1+0.08*k,0.2,0.1,v[2],true,oknotow) 
    towar[2] = guiCreateLabel (0.27,0.1+0.08*k,0.2,0.1,v[3],true,oknotow) 
    towar[3] = guiCreateLabel (0.46,0.1+0.08*k,0.2,0.1,v[4].."$",true,oknotow) 
    towar[4] = guiCreateLabel (0.68,0.1+0.08*k,0.2,0.1,v[5].."$",true,oknotow) 
    kupuj[k] = guiCreateButton (0.83,0.095+0.08*k,0.13,0.06,"Zaladuj",true,oknotow) 
    addEventHandler ( "onClientGUIClick", kupuj [ k ], zakup, false ) 
end 
zamknij = guiCreateButton (0.45,0.9,0.15,0.07,"Zamknij",true,oknotow) 
addEventHandler ( "onClientGUIClick", zamknij, closegui ) 
  
for k, v in ipairs ( towary ) do 
    guiSetEnabled ( kupuj [ k ], ( playerPoints >= v [ 3 ] ) ) 
end 

for k, v in ipairs ( towary ) do 
    guiSetEnabled ( kupuj [ k ], ( playerPoints >= v [ 3 ] ) ) 
end 

You must use that when you open the GUI.

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