Jump to content

hepl again please xD


bartje01

Recommended Posts

Posted

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

Posted

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) 

Posted

type /debugscript 3 in-game and tell us if there are errors, if there are post them here.

P.S: please use 1 topic for all the problems of same script!

Posted

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) 
  

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

Posted

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

Posted

rest of your script could broke something

ERROR:freerpg/script/lua.133:attempt to call global 'guiCreateWindow' (a nil value)

post whole script or send it via pm to me or Solid (if he doesnt have anything against pming him)

Posted

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.

Posted

Ye I am really sorry that I'm asking so many questions. But that is the way I learn the best.

Tutorials have a low effect on me.

Now I do understand that local didn't work.

With that tutorial I shouldn't know that.

Thanks very much.

Posted

local thing is one the first things tutorial is explaining.

ofc only reading them won't help you to understand, but writing, following and doing modifications to examples in tutorial - will make you know everything.

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