GamerDeMTA Posted March 23, 2013 Share Posted March 23, 2013 okay, I did a GUI and when i start the resource is OK, but when I say the Command it doesn't work, and in console says "attempt to call global line 5" this is the line 5, something is wrong? window = guiCreateWindow(77, 12, 642, 545, "bla bla bla", false) Link to comment
golanu21 Posted March 23, 2013 Share Posted March 23, 2013 server side or clientside ??? Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 no no thanks it's solved was another error Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 server side or clientside ??? @golanu guiCreateWindow is only client-side. And the error was that you put server in meta.xml. Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 hey how to change this? function a() giveWeapon ( source, 17, 1 ) end I want to take player's money (1000$) when he does. Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 function a(source) giveWeapon ( source, 17, 1 ) local money = getPlayerMoney(source) if money >= 1000 then takePlayerMoney(source, 1000) end end Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 thanks and I want this also... When I put the command for my GUI two times is opened 2 times :C How to do that when u type it again when the GUI is opened, the gui closes? Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 Put this part of the script when you put the command. Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 Put this part of the script when you put the command. addCommandHandler ("open", myfunction) Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 Put this part of the script when you put the command. addCommandHandler ("open", myfunction) And the function... :_ Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 function myfunction() window = guiCreateWindow(77, 12, 642, 545, "window!", false) guiWindowSetSizable(window, false) guiSetAlpha(window, 0.80) showCursor (true) guiSetVisible(window,true) end that's de function Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 Try this: function createWindow() window = guiCreateWindow(77, 12, 642, 545, "window!", false) guiWindowSetSizable(window, false) guiSetAlpha(window, 0.80) guiSetVisible(window, false) end addEventHandler("onClientResourceStart", getRootElement(), createWindow) function myfunction() if (guiGetVisible(window) == false) then showCursor(true) guiSetVisible(window,true) else showCursor(false) guiSetVisible(window, false) end end addCommandHandler ("open", myfunction) Link to comment
GamerDeMTA Posted March 23, 2013 Author Share Posted March 23, 2013 function a(source) giveWeapon ( source, 17, 1 ) local money = getPlayerMoney(source) if money >= 1000 then takePlayerMoney(source, 1000) end end hey man it doesn't works. Well, it works, but I don't need the money for buy. But If i have the money, My Money goes less. If I have "0" of money, I can buy for free ._. Link to comment
Sasu Posted March 23, 2013 Share Posted March 23, 2013 function a(source) giveWeapon ( source, 17, 1 ) local money = getPlayerMoney(source) if money >= 1000 then takePlayerMoney(source, 1000) end end hey man it doesn't works. Well, it works, but I don't need the money for buy. But If i have the money, My Money goes less. If I have "0" of money, I can buy for free ._. Ohhh yes. I am sorry. function a(source) local money = getPlayerMoney(source) if money >= 1000 then takePlayerMoney(source, 1000) giveWeapon ( source, 17, 1 ) else outputChatBox("You have not money to buy this weapon", source, 255, 0, 0, false) end end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now