Jump to content

Why this doesn't work?


GamerDeMTA

Recommended Posts

Posted

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) 

Posted
server side or clientside ???

@golanu guiCreateWindow is only client-side.

And the error was that you put server in meta.xml.

Posted
function a(source) 
    giveWeapon ( source, 17, 1 ) 
local money = getPlayerMoney(source) 
if money >= 1000 then 
takePlayerMoney(source, 1000) 
end 
end 

Posted

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?

Posted
Put this part of the script when you put the command.
addCommandHandler ("open", myfunction) 

And the function... :_

Posted
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

Posted

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) 

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

Posted
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 

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