Jean Posted September 3, 2012 Share Posted September 3, 2012 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 Link to comment
Castillo Posted September 3, 2012 Share Posted September 3, 2012 Could you tell us what "went wrong"? Link to comment
Jean Posted September 3, 2012 Author Share Posted September 3, 2012 Its not giving the money.... Link to comment
Castillo Posted September 3, 2012 Share Posted September 3, 2012 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. Link to comment
Jean Posted September 3, 2012 Author Share Posted September 3, 2012 Could you help me with the code? Link to comment
Anderl Posted September 3, 2012 Share Posted September 3, 2012 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/ Link to comment
TAPL Posted September 3, 2012 Share Posted September 3, 2012 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. 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