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) 

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

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!

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

you are doing the script server side not client side!

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

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

and your meta.xml is?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

there is no reason to say a nil value about guiCreateWindow..

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

can you zip and upload whole resource somewhere?

if u scared about it being stolen - you can send it to me via pm

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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.

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

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)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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

you have created your gui as "local"

maybe instead of asking thousands question read tutorials?

https://wiki.multitheftauto.com/wiki/Scr ... troduction

https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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