Jump to content

Hugo_Almeidowski

Members
  • Posts

    71
  • Joined

  • Last visited

Everything posted by Hugo_Almeidowski

  1. What difference does it make if it doesn't even send the message?
  2. Have you made both a script for client and another one for server?
  3. I don't understand what you said I have put the DGS = exports.dgs Ok I understand now, thanks. I was dumb hehehe
  4. function MarkerHit (localPlayer, dimensao) janelaEmpregos = DGS:dgsCreateWindow (0.015, 0.18, 0.3, 0.3, "Empregos", true) DGS:dgsWindowSetCloseButtonEnabled(janelaEmpregos, false) showCursor(true) DGS:dgsSetInputMode("no_binds_when_editing") DGS:dgsWindowSetSizable(janelaEmpregos, false) local listaEmpregos = DGS:dgsCreateGridList (0.05, 0.03, 0.9, 0.75, true, janelaEmpregos) local coluna1 = DGS:dgsGridListAddColumn(listaEmpregos, "Emprego", 0.5) local coluna2 = DGS:dgsGridListAddColumn(listaEmpregos, "Localização", 0.5) DGS:dgsGridListAddRow(listaEmpregos, 1, "Entregador de Pizza", "San Fierro") DGS:dgsGridListAddRow(listaEmpregos, 2, "Camionista", "San Fierro") DGS:dgsGridListAddRow(listaEmpregos, 3, "Entregador de Pizza", "San Fierro") buttonC = DGS:dgsCreateButton(0.60, 0.815, 0.25, 0.15, "Cancelar", true, janelaEmpregos) addEventHandler ("onDgsMouseClick", buttonC, cancelamentoJanelaEmpregos) buttonE = DGS:dgsCreateButton(0.15, 0.815, 0.25, 0.15, "Escolher", true, janelaEmpregos) addEventHandler ("onDgsMouseClick", buttonE, escolhaJanelaEmpregos) end addEventHandler ( "onClientMarkerHit", agenciaEmpregos, MarkerHit ) function cancelamentoJanelaEmpregos() DGS:dgsCloseWindow(janelaEmpregos) showCursor(false) end function escolhaJanelaEmpregos() outputChatBox("OLA") local selected = DGS:dgsGridListGetSelectedItem(listaEmpregos) if selected == 1 then outputChatBox("lol") end DGS:dgsCloseWindow(janelaEmpregos) showCursor(false) end Why is the second function not working? It sends the first ChaBox (OLA) but then, it doesn't send the second chatbox (lol) If I change selected == 1 to selected ~= 1 it works with every item, including the first one
  5. healthBar = DGS:dgsCreateProgressBar(0.40, 0.93, 0.2, 0.04, true) dgsSetProperty(healthBar,"bgColor",tocolor(255, 0, 0, 50)) dgsSetProperty(healthBar,"indicatorColor",tocolor(0, 250, 0, 50)) armorBar = DGS:dgsCreateProgressBar(0.40, 0.88, 0.2, 0.04, true) local screenWidth, screenHeight = guiGetScreenSize ( ) function updateBars () local playerHealth = getElementHealth (localPlayer ) DGS:dgsProgressBarSetProgress(healthBar, playerHealth) local playerArmor = getPedArmor(localPlayer) DGS:dgsProgressBarSetProgress(armorBar, playerArmor) local timehour, timeminute = getTime() dxDrawText (timehour.. ":".. timeminute.. "h", 532, screenHeight - 139, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "pricedown" ) end addEventHandler ( "onClientRender", root, updateBars ) It is not working. Everything below just stopped working and the bar didn't change colors
  6. How do I change these progress bars colors? healthBar = DGS:dgsCreateProgressBar(0.40, 0.93, 0.2, 0.04, true) armorBar = DGS:dgsCreateProgressBar(0.40, 0.88, 0.2, 0.04, true) function updateBars () local playerHealth = getElementHealth (localPlayer ) DGS:dgsProgressBarSetProgress(healthBar, playerHealth) local playerArmor = getPedArmor(localPlayer) DGS:dgsProgressBarSetProgress(armorBar, playerArmor) end addEventHandler ( "onClientRender", root, updateBars )
  7. It returns these: Bad argument @ outputChatBox Expected string at argument 1, got nil Bad argument @ getElementPosition Expected element at argument 1, got string 462 Bad argument @ getElementPosition Expected element at argument 1, got string 462 (I changed the code a bit) Bad argument @ outputChatBox Expected string at argument 1, got nil Bad argument @ triggerClientEvent Expected element at argument 2, got string 462
  8. Thanks for the tip! But this way, wouldn't all the wires with the model I choosen be replaced? Like, tons of Trump Towers would appear in the map?
  9. So I made a script where if you type /cv [400-611] it will spawn a vehicle, and if you type no number, then it will open a GUI that allows you to type a number. After typing the number in the GUI and clicking "Choose" it should read the function again and create a vehicle with the number that is written in the editbox. It was based on another script I made that workes perfectly fine, so there shouldn't be no reason for this one no to work... CLIENT (Everything works until the last function): function criarVeiculo() janelaVeiculos = DGS:dgsCreateWindow (0.015, 0.18, 0.10, 0.20, "Criar Veículo", true) DGS:dgsWindowSetCloseButtonEnabled(janelaVeiculos, false) showCursor(true) DGS:dgsSetInputMode("no_binds_when_editing") DGS:dgsWindowSetSizable(janelaVeiculos, false) modeloVeiculo = DGS:dgsCreateEdit(0.1, 0.07, 0.8, 0.17, "Modelo do Veículo [400-611]", true, janelaVeiculos) guiEditSetMaxLength (modeloVeiculo, 20) addEventHandler("onDgsMouseClick", modeloVeiculo, mudarTextoModeloVeiculo) buttonCV = DGS:dgsCreateButton(0.53, 0.73, 0.37, 0.20, "Cancelar", true, janelaVeiculos) addEventHandler ("onDgsMouseClick", buttonCV, cancelamentojanelaVeiculos) buttonEV = DGS:dgsCreateButton(0.1, 0.73, 0.37, 0.20, "Escolher", true, janelaVeiculos) addEventHandler ("onDgsMouseClick", buttonEV, escolhajanelaVeiculos) end addEvent("veiculoJanela", true) addEventHandler("veiculoJanela", getLocalPlayer(), criarVeiculo) function mudarTextoModeloVeiculo() DGS:dgsEditClearText(modeloVeiculo) end function cancelamentojanelaVeiculos() DGS:dgsCloseWindow(janelaVeiculos) showCursor(false) end function escolhajanelaVeiculos() local textoModeloVeiculo = DGS:dgsGetText(modeloVeiculo) triggerServerEvent("criarVeiculo", resourceRoot, textoModeloVeiculo) DGS:dgsCloseWindow(janelaVeiculos) showCursor(false) end After I type a correct model on the box it returns this erros on the server: Line 19: Bad argument @ 'outputChatBox' [Excpected string at argument 1, got nil] Line 18: Bad argument @ 'getElementPosition0 [Expected element at argument 1, got string 457' (this means it sends the correct number to the server, but not in the right place) Line 19: Bad argument @ 'outputChatBox' [Excpected string at argument 1, got nil] Line 20: attempt to perform arithmetic on local 'y' (a nil value) If I change resourceRoot to anything else, it returns this errors on the server: Line 19: Bad argument @ 'outputChatBox' Expected string at argument 1, got nil SERVER: function createVehicleForPlayer(player, command, model) local x, y, z = getElementPosition(player) outputChatBox(model) y = y + 5 if model then outputChatBox("Ola2") local veiculoCriado = createVehicle(model, x, y, z) local nomeVeiculo = getVehicleName(veiculoCriado) if veiculoCriado then outputChatBox(horaJ.. "Criaste um " ..corVeiculo.. nomeVeiculo.. corMJ.. " (modelo: "..corVeiculo.. model.. corMJ.. ") com sucesso.", player, isR, isG, isB, true) addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion) else outputChatBox(horaE.. corErro.. "Uso: /cv [" ..corVeiculo.. "400" ..corErro.. "-" ..corVeiculo.. "611" ..corErro.. "].", player, isR, isG, isB, true) end else triggerClientEvent("veiculoJanela", player) outputChatBox("Feito") end end addCommandHandler('cv', createVehicleForPlayer) addCommandHandler('criarveiculo', createVehicleForPlayer) addEvent("criarVeiculo", true) addEventHandler("criarVeiculo", resourceRoot, createVehicleForPlayer) If at the addEventHandler("criarVeiculo") I change resourceRoot to localPlayer, it returns this error: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] Thanks for the help!
  10. What are the limits for importing 3d models to MTA, how can I do it, and do I need to replace another models or can I add a completely new one? Like, can I import a real size Trump Tower or something?
  11. I've done it like this if argument and argument2 and argument3 then else if argument and argument2 then else if argument then else end
  12. But for what I've been coding it seems that if argument then end means that if argument == true (is valid) then so what if I want to check if the argument is valid?
  13. So, if argument = nil then end Right? Thanks!
  14. I can't find anything on Google. So, I made this command called /criarped that has three arguments. If I don't put all the three arguments, it returns an error I want it that if I don't put let's say the third argument, it will just get my dimension. (I can do this) I just don't know how to check if the argument is empty
  15. Before I converted this guiWindow to DGS, everything was ok, but now, the peds are not showing. Instead, it shows the ped model in the Name column, the ped dimension in the model column and nothing in the dimension column. If I put the MTA GUI window back, the peds name show. function pedsJanela() pedsJanela = DGS:dgsCreateWindow (0.25, 0.15, 0.30, 0.4, "Peds", true) local listaPeds = DGS:dgsCreateGridList (0, 0.1, 1, 0.75, true, pedsJanela) DGS:dgsWindowSetMovable(pedsJanela, true) DGS:dgsWindowSetSizable(pedsJanela, false) showCursor(true) coluna1 = DGS:dgsGridListAddColumn(listaPeds, "Nome", 0.33) coluna2 = DGS:dgsGridListAddColumn(listaPeds, "Modelo", 0.33) coluna3 = DGS:dgsGridListAddColumn(listaPeds, "Dimensão", 0.33) local all_peds = getElementsByType("ped") for id, ped in ipairs(all_peds) do local ped1name = getElementID(ped) local ped1model = getElementModel(ped) local ped1dimension = getElementDimension(ped) DGS:dgsGridListAddRow(listaPeds, ped1name, ped1model, ped1dimension) end local button = DGS:dgsCreateButton(0.6, 0.87, 0.3, 0.1, "Cancelar", true, pedsJanela) addEventHandler ( "onDgsMouseClick", button, cancelamentoPedsJanela) local button2 = DGS:dgsCreateButton(0.1, 0.87, 0.3, 0.1, "Escolher", true, pedsJanela) addEventHandler ("onDgsMouseClick", button2, escolhaPedsJanela) end addCommandHandler("peds", pedsJanela) I've also noticed that if I gave them an ID that consists only of numbers, they don't even show up in the list.
  16. I made it work. I created a new client2.lua Copied literally the same code Now it works... wat And it stopped working again... wtf It's something related with this code (that comes after the one we were trying to fix) function checkPing() local ping = getPlayerPing(getLocalPlayer()) outputChatBox(ping, localPlayer) if (ping > 200) then outputChatBox("O teu ping é".. ping.. ". Está muito elevado! Tenta reduzi-lo se possível.") else if (ping <100) then outputChatBox("O teu ping é".. ping.. ". Está ótimo! Tenta mantê-lo assim.") else outputChatBox("O teu ping é".. ping.. ". Está razoável! Tenta que não aumente.") end end addCommandHandler("pingz", checkPing) Whenever I take it out of the script, it works.
  17. So, I made this script that whenever I type /armas, it opens a window with two text box, one to input a weapon ID and another to input the bullets (this one is still deactivated). When I press the button, it trigger a server event to give the player a weapon, but the problem is that I can only give weapons to root, if I try to give it to the player, it returns: Bad Argument @ expect element at argument 1, got nil after the giveWeapon function. I tried multiple ways but I can't seem to make it work CLIENT: DGS = exports.dgs function armasJanela() janelaArmas = DGS:dgsCreateWindow (0.015, 0.18, 0.10, 0.15, "Armas", true) DGS:dgsWindowSetCloseButtonEnabled(janelaArmas, false) showCursor(true) DGS:dgsSetInputMode("no_binds_when_editing") DGS:dgsWindowSetSizable(janelaArmas, false) IDArma = DGS:dgsCreateEdit(0.1, 0.09, 0.8, 0.20, "ID da Arma [0-46]", true, janelaArmas) guiEditSetMaxLength (IDArma, 20) Balas = DGS:dgsCreateEdit(0.1, 0.33, 0.8, 0.20, "Balas [0-10000]", true, janelaArmas) guiEditSetMaxLength (Balas, 6) buttonC = DGS:dgsCreateButton(0.53, 0.65, 0.37, 0.20, "Cancelar", true, janelaArmas) addEventHandler ("onDgsMouseClick", buttonC, cancelamentoJanelaArmas) buttonE = DGS:dgsCreateButton(0.1, 0.65, 0.37, 0.20, "Escolher", true, janelaArmas) addEventHandler ("onDgsMouseClick", buttonE, escolhaJanelaArmas) end addCommandHandler("armas", armasJanela) function cancelamentoJanelaArmas() local destruirArmasJanela = DGS:dgsCloseWindow(janelaArmas) destroyElement(destruirArmasJanela) showCursor(false) end function escolhaJanelaArmas() local textoIDArma = DGS:dgsGetText(IDArma) outputChatBox(tostring(textoIDArma)) triggerServerEvent("darArmaClient", resourceRoot, textoIDArma) outputChatBox("Olas") end SERVER: function darArmaClient(textoIDArma) outputChatBox("Ola" ..textoIDArma, player) nomeA = getWeaponNameFromID(textoIDArma) outputChatBox(nomeA) giveWeapon(root, textoIDArma, 999) outputChatBox("Erro") end addEvent("darArmaClient", true) addEventHandler("darArmaClient", root, darArmaClient) If in the event handler I switch root to player, it returns that he is expecting an element.
  18. What if I want to export the whole resource? I made it. Thanks
  19. Does anybody know how to install the DGS resource to my server? https://wiki.multitheftauto.com/wiki/Resource:Dgs And how to use it? Just type the functions or do I need to export it to every script or something like that?
×
×
  • Create New...