Jump to content

hepl again please xD


bartje01

Recommended Posts

Hey guys. my gui is workign a bit now

function buyweapon(playerSource, commandName) 
    local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true )  
    local buyweapondeagle = guiCreateButton ( 0.2915, 0.0369, 0.4242, 0.0641, "Deagle", true )  
    local buyweapontec-9 = guiCreateButton ( 0.2938, 0.1058, 0.4265, 0.0609, "Tec-9", true )  
  
  
guiSetVisible ( buyweapon, true ) 
guiSetVisible ( buyweapondeagle, true ) 
guiSetVisible ( buyweapontec-9, true ) 
  
end 
addCommandHandler("buyweapons", buyweapon) 

With only the guiSetVisible ( buyweapon, true ) it works

But with the other two the gui won't show up anymore.

Help please

Link to comment

you're doing it wrong, i recommend to read this: https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI

function buyweapon(playerSource, commandName) 
    local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true ) 
    local buyweapondeagle = guiCreateButton ( 0.2915, 0.0369, 0.4242, 0.0641, "Deagle", true, buyWeapon ) 
    local buyweapontec-9 = guiCreateButton ( 0.2938, 0.1058, 0.4265, 0.0609, "Tec-9", true, buyWeapon ) 
guiSetVisible ( buyweapon, true )  
end 
addCommandHandler("buyweapons", buyweapon) 

Link to comment

This is my client.lua

  
    function buyweapon(playerSource, commandName) 
        local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true ) 
        local buyweapondeagle = guiCreateButton ( 0.2915, 0.0369, 0.4242, 0.0641, "Deagle", true, buyWeapon ) 
        local buyweapontec-9 = guiCreateButton ( 0.2938, 0.1058, 0.4265, 0.0609, "Tec-9", true, buyWeapon ) 
    guiSetVisible ( buyweapon, true ) 
    end 
    addCommandHandler("buyweapons", buyweapon) 
  

Link to comment
function buyweapon(playerSource, commandName) 
        local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true ) 
        local buyweapondeagle = guiCreateButton ( 0.2915, 0.0369, 0.4242, 0.0641, "Deagle", true, buyWeapon ) 
        local buyweapontec9 = guiCreateButton ( 0.2938, 0.1058, 0.4265, 0.0609, "Tec-9", true, buyWeapon ) 
    guiSetVisible ( buyweapon, true ) 
end 
addCommandHandler("buyweapons", buyweapon) 

this code works fine at my server.

btw: you added at buyweapontec9 you did buyweapontec-9 and that makes a unexpected simbol.

Link to comment

No effect but no errors or warnings eitehr

Without the buttons the menu will show up:

  
function buyweapon(playerSource, commandName) 
        local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true ) 
        
    guiSetVisible ( buyweapon, true ) 
end 
addCommandHandler("buyweapons", buyweapon) 
  

But with the buttons nothing shows up

Link to comment

Now why doesn't this work?

I want that when you click on the weaponx button the gui dissapears.

  
  
addEventHandler ("onClientGUIClick",getRootElement(), 
function(button) 
  if (source == buyweaponx) then 
    guiSetVisible (buyweapon,false) 
    showCursor (false,false) 
   
  end 
end) 
  

No effect.

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