Jump to content

Hugo_Almeidowski

Members
  • Posts

    71
  • Joined

  • Last visited

Recent Profile Visitors

515 profile views

Hugo_Almeidowski's Achievements

Transformer

Transformer (11/54)

6

Reputation

  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?
×
×
  • Create New...