Jump to content

Whats wrong?


Jean

Recommended Posts

Posted

Hey guys, im new of the forum, and i was making a give cash menu with GUI and something got wrong, i dunno why, can u guys help me? Thanks.

  
function criarJanela() 
    -- definir a posição X e Y da janela 
    local X = 0.375 
    local Y = 0.375 
     
    local Largura = 0.25 
    local Altura = 0.25 
     
    wdwLogin = guiCreateWindow(X, Y, Largura, Altura, "Janela Normal", true) 
     
    X = 0.0391 
    Y = 0.1979 
  
    Largura = 0.3672 
    Altura = 0.25 
     
    guiCreateLabel(X, Y, Largura, Altura, "Arma:", true, wdwLogin) 
     
    Largura = 0.25 
    Y = 0.5 
    guiCreateLabel(X, Y, Largura, Altura, "Munição:", true, wdwLogin) 
  
    X = 0.415 
    Y = 0.2 
    Largura = 0.5 
    Altura = 0.15 
    editUsuario = guiCreateEdit(X, Y, Largura, Altura, "", true, wdwLogin) 
    Y = 0.5 
    edtSenha = guiCreateEdit(X, Y, Largura, Altura, "", true, wdwLogin) 
     
    guiEditSetMaxLength(editUsuario, 50) 
    guiEditSetMaxLength(edtSenha, 50) 
  
    X = 0.200 
    Y = 0.7 
    Largura = 0.25 
    Altura = 0.2 
    btnLogin = guiCreateButton(X, Y, Largura, Altura, "Comprar", true, wdwLogin) 
     
    X = 0.520 
    Y = 0.7 
    Largura = 0.25 
    Altura = 0.2 
    btnSair = guiCreateButton(X, Y, Largura, Altura, "Sair", true, wdwLogin) 
     
    showCursor(true,true) 
     
    addEventHandler("onClientGUIClick", btnLogin, buyGuns, false) 
    addEventHandler("onClientGUIClick", btnSair, closeGUI, false) 
end 
addCommandHandler("armas", criarJanela) 
  
function buyGuns() 
        local pessoa = getLocalPlayer() 
        local arma = guiGetText(editUsuario) 
        local municao = guiGetText(edtSenha) 
        givePlayerMoney(pessoa, tonumber(arma)) 
        outputChatBox("Arma: "..arma.." Munição:"..municao..".", pessoa) 
end 
  
function closeGUI() 
    guiSetVisible(wdwLogin, false) 
    showCursor(false,false) 
end 
  

Posted

Could you tell us what "went wrong"?

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

1: The client side givePlayerMoney has no player argument.

2: You must give the money server side, or the money won't be given at all.

3: You can use triggerServerEvent to trigger a server side event so you can then give the money.

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
Could you help me with the code?

Solidsnake14 already explained you what you need, if you don't understand, you should learn Lua.

Use wiki too: https://wiki.multitheftauto.com/

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

As Solidsnake14 said "The client side givePlayerMoney has no player argument"

This:

givePlayerMoney(pessoa, tonumber(arma)) 

should be:

givePlayerMoney(tonumber(arma)) 

Also outputChatBox Client Side has no player argument.

so This:

outputChatBox("Arma: "..arma.." Munição:"..municao..".", pessoa) 

should be:

outputChatBox("Arma: "..arma.." Munição:"..municao..".") 

and line 55 not needed, remove it.

CiTLh.png

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