Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Type the command /debugscript 3 and check if it shows any error/warning. If it has no erros, I have no idea... this script is badly written and optimized.
  2. Um exemplo: client addEventHandler("onClientResourceStart", resourceRoot, function() playersList = guiCreateGridList(0.30, 0.28, 0.11, 0.49, true) local column = guiGridListAddColumn(playersList, "Jogadores", 0.9) if (column) then for _, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(playersList) guiGridListSetItemText (playersList, row, 1, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", ""), false, false) end end guiSetAlpha(playersList, 0.80) guiSetVisible(playersList, false) end ) addEventHandler( "onClientGUIClick", guiRoot, function( b ) if b ~= "left" then return end if source == playersList then local playername = guiGridListGetSelectedText(source) if playername and getPlayerFromName(playername) then triggerServerEvent( "onClientSelectPlayer", getPlayerFromName(playername) ) end end end ) function guiGridListGetSelectedText(gridList, columnIndex) local selectedItem = guiGridListGetSelectedItem(gridList) if (selectedItem) then local text = guiGridListGetItemText(gridList, selectedItem, columnIndex or 1) if (text) and not (text == "") then return text end end return false end server addEvent( "onClientSelectPlayer", true ) addEventHandler( "onClientSelectPlayer", root, function() outputChatBox( "O jogador '"..getPlayerName(client).."' iniciou uma conversa com você", source ) triggerClientEvent( source, "eventname", source ) -- chamar o evento client para o player selecionado end ) @#DeltaSCR
  3. DNL291

    [HELP] Text

    Show us your code. If you still don't understand the basics of scripting I suggest you downloading a custom editbox resource instead of trying to make something that isn't within your reach.
  4. What are you trying to do @Hugos? Provide us with some information.
  5. https://wiki.multitheftauto.com/wiki/IsPlayerInACL
  6. Try: function addMessage(player, text, type) triggerClientEvent(player, "addRoyalMessage", root, text, type) end Desativar_Expulsar = true -- (true = Desativa Expulsar todos do Veiculo) (false = Ativa ) Desativar_Desconectar_Veiculo = true -- (true = Desativa "Desconectar Veiculo") (false = Ativa ) local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local font = dxCreateFont(":util_fonts/fonts/gtav.ttf", x*12, false, "proof") PainelVeiculos = false setElementData ( localPlayer, "Painel-Config", "0" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_01_Estado", "Desconectado" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_02_Estado", "Desconectado" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_03_Estado", "Desconectado" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_04_Estado", "Desconectado" ) function PainelVehAirNewSCR () dxDrawRectangle(x*540, y*214, x*275, y*22, tocolor(220, 220, 220), false) dxDrawText("Gerenciador de Veiculos", x*425, y*214, x*933, y*236, tocolor(0, 0, 0), x*1.00, font, "center", "center", false, false, false, false, false) dxDrawRectangle(x*540, y*236, x*275, y*274, tocolor(190, 190, 190), false) if getElementData ( localPlayer, "Painel-Config" ) == "0" then if Posicao_Mouse( x*550, y*271, x*250, y*27 ) then dxDrawRectangle(x*550, y*271, x*250, y*27, tocolor(16, 111, 231), false) -- Slot 01 else dxDrawRectangle(x*550, y*271, x*250, y*27, tocolor(220, 220, 220), false) -- Slot 01 end if Posicao_Mouse( x*550, y*301, x*250, y*27 ) then dxDrawRectangle(x*550, y*301, x*250, y*27, tocolor(16, 111, 231), false) -- Slot 02 else dxDrawRectangle(x*550, y*301, x*250, y*27, tocolor(220, 220, 220), false) -- Slot 02 end if Posicao_Mouse( x*550, y*331, x*250, y*27 ) then dxDrawRectangle(x*550, y*331, x*250, y*27, tocolor(16, 111, 231), false) -- Slot 03 else dxDrawRectangle(x*550, y*331, x*250, y*27, tocolor(220, 220, 220), false) -- Slot 03 end if Posicao_Mouse( x*550, y*361, x*250, y*27 ) then dxDrawRectangle(x*550, y*361, x*250, y*27, tocolor(16, 111, 231), false) -- Slot 04 else dxDrawRectangle(x*550, y*361, x*250, y*27, tocolor(220, 220, 220), false) -- Slot 04 end AirNewSCR_Veiculo_Slot_01 = tonumber( getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_01" ) ) AirNewSCR_Veiculo_Slot_02 = tonumber( getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_02" ) ) AirNewSCR_Veiculo_Slot_03 = tonumber( getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_03" ) ) AirNewSCR_Veiculo_Slot_04 = tonumber( getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_04" ) ) local slot1VehName = Nomes_Veiculos_Editados[AirNewSCR_Veiculo_Slot_01] or getVehicleNameFromModel(AirNewSCR_Veiculo_Slot_01) local slot2VehName = Nomes_Veiculos_Editados[AirNewSCR_Veiculo_Slot_02] or getVehicleNameFromModel(AirNewSCR_Veiculo_Slot_02) local slot3VehName = Nomes_Veiculos_Editados[AirNewSCR_Veiculo_Slot_03] or getVehicleNameFromModel(AirNewSCR_Veiculo_Slot_03) local slot4VehName = Nomes_Veiculos_Editados[AirNewSCR_Veiculo_Slot_04] or getVehicleNameFromModel(AirNewSCR_Veiculo_Slot_04) if AirNewSCR_Veiculo_Slot_01 == "NC" or AirNewSCR_Veiculo_Slot_01 == nil then dxDrawText("Slot Vazio", x*650, y*271, x*896, y*298, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) else Veiculo_Slot_01_Estado = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_01_Estado" ) or nil dxDrawText(""..(slot1VehName or "N/A").." / "..AirNewSCR_Veiculo_Slot_01.." - "..Veiculo_Slot_01_Estado, x*600, y*271, x*896, y*298, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) end if AirNewSCR_Veiculo_Slot_02 == "NC" or AirNewSCR_Veiculo_Slot_02 == nil then dxDrawText("Slot Vazio", x*650, y*301, x*896, y*328, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) else Veiculo_Slot_02_Estado = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_02_Estado" ) or nil dxDrawText(""..(slot2VehName or "N/A").." / "..AirNewSCR_Veiculo_Slot_02.." - "..Veiculo_Slot_02_Estado, x*600, y*301, x*896, y*328, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) end if AirNewSCR_Veiculo_Slot_03 == "NC" or AirNewSCR_Veiculo_Slot_03 == nil then dxDrawText("Slot Vazio", x*650, y*331, x*896, y*358, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) else Veiculo_Slot_03_Estado = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_03_Estado" ) or nil dxDrawText(""..(slot3VehName or "N/A").." / "..AirNewSCR_Veiculo_Slot_03.." - "..Veiculo_Slot_03_Estado, x*600, y*331, x*896, y*358, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) end if AirNewSCR_Veiculo_Slot_04 == "NC" or AirNewSCR_Veiculo_Slot_04 == nil then dxDrawText("Slot Vazio", x*650, y*361, x*896, y*388, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) else Veiculo_Slot_04_Estado = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_04_Estado" ) or nil dxDrawText(""..(slot4VehName or "N/A").." / "..AirNewSCR_Veiculo_Slot_04.." - "..Veiculo_Slot_04_Estado, x*600, y*361, x*896, y*388, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) end end -- Config 01 if getElementData ( localPlayer, "Painel-Config" ) == "1" then if Posicao_Mouse( x*548, y*213, x*29, y*15 ) then dxDrawText("<", x*548, y*213, x*474, y*232, tocolor(16, 111, 231), x*1.20, font, "left", "top", false, false, false, false, false) else dxDrawText("<", x*548, y*213, x*474, y*232, tocolor(0, 0, 0), x*1.20, font, "left", "top", false, false, false, false, false) end if Posicao_Mouse( x*550, y*301, x*250, y*27 ) then dxDrawRectangle(x*550, y*301, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*301, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Conectar o Veiculo", x*615, y*301, x*896, y*328, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) if Posicao_Mouse( x*550, y*331, x*250, y*27 ) then dxDrawRectangle(x*550, y*331, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*331, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Salvar Na Posição Atual", x*615, y*331, x*896, y*358, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) if Posicao_Mouse( x*550, y*361, x*250, y*27 ) then dxDrawRectangle(x*550, y*361, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*361, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Vender Veiculo (75%)", x*615, y*361, x*896, y*388, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) if Posicao_Mouse( x*550, y*391, x*250, y*27 ) then dxDrawRectangle(x*550, y*391, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*391, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Trancar/Destrancar", x*615, y*391, x*896, y*418, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) if Posicao_Mouse( x*550, y*421, x*250, y*27 ) then dxDrawRectangle(x*550, y*421, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*421, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Localizar/Deslocalizar", x*615, y*421, x*896, y*448, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) if Posicao_Mouse( x*550, y*451, x*250, y*27 ) then dxDrawRectangle(x*550, y*451, x*250, y*27, tocolor(16, 111, 231), false) else dxDrawRectangle(x*550, y*451, x*250, y*27, tocolor(220, 220, 220), false) end dxDrawText("Desativado", x*615, y*451, x*896, y*478, tocolor(0, 0, 0), x*1.00, font, "left", "center", false, false, false, false, false) end end function AbrirPainel () if PainelVeiculos == false then showCursor ( true ) addEventHandler ( "onClientRender", root, PainelVehAirNewSCR ) PainelVeiculos = true else showCursor ( false ) removeEventHandler ( "onClientRender", root, PainelVehAirNewSCR ) PainelVeiculos = false setElementData ( localPlayer, "Painel-Config", "0" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", nil ) end end bindKey ("F2", "down", AbrirPainel ) function SelecionarOpcaoParte0 (_,state) if PainelVeiculos == true then if state == "down" then local AirNewSCR_Veiculo_Slot_01 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_01" ) or nil local AirNewSCR_Veiculo_Slot_02 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_02" ) or nil local AirNewSCR_Veiculo_Slot_03 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_03" ) or nil local AirNewSCR_Veiculo_Slot_04 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_04" ) or nil if getElementData ( localPlayer, "Painel-Config" ) == "0" then if Posicao_Mouse ( x*910, y*214, x*23, y*22 ) then -- Fechar AbrirPainel () -- Fechar elseif Posicao_Mouse ( x*550, y*271, x*250, y*27 ) then -- Slot 01 if AirNewSCR_Veiculo_Slot_01 == "NC" then else setTimer ( function() setElementData ( localPlayer, "Painel-Config", "1" ) end, 50, 1 ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", "1" ) end elseif Posicao_Mouse ( x*550, y*301, x*250, y*27 ) then -- Slot 02 if AirNewSCR_Veiculo_Slot_02 == "NC" then else setTimer ( function() setElementData ( localPlayer, "Painel-Config", "1" ) end, 50, 1 ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", "2" ) end elseif Posicao_Mouse ( x*550, y*331, x*250, y*27 ) then -- Slot 03 if AirNewSCR_Veiculo_Slot_03 == "NC" then else setTimer ( function() setElementData ( localPlayer, "Painel-Config", "1" ) end, 50, 1 ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", "3" ) end elseif Posicao_Mouse ( x*550, y*361, x*250, y*27 ) then -- Slot 04 if AirNewSCR_Veiculo_Slot_04 == "NC" then else setTimer ( function() setElementData ( localPlayer, "Painel-Config", "1" ) end, 50, 1 ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", "4" ) end end end end end end addEventHandler ( "onClientClick", root, SelecionarOpcaoParte0 ) function SelecionarOpcaoParte1 (_,state) if PainelVeiculos == true then if state == "down" then if getElementData ( localPlayer, "Painel-Config" ) == "1" then local AirNewSCR_Veiculo_Slot_01 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_01" ) or nil local AirNewSCR_Veiculo_Slot_02 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_02" ) or nil local AirNewSCR_Veiculo_Slot_03 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_03" ) or nil local AirNewSCR_Veiculo_Slot_04 = getElementData ( localPlayer, "AirNewSCR_Veiculo_Slot_04" ) or nil if Posicao_Mouse ( x*910, y*214, x*23, y*22 ) then -- Fechar AbrirPainel () -- Fechar elseif Posicao_Mouse ( x*548, y*213, x*29, y*15 ) then -- Voltar setElementData ( localPlayer, "Painel-Config", "0" ) setElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado", nil ) elseif Posicao_Mouse ( x*471, y*301, x*425, y*27 ) then -- Conectar Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then triggerServerEvent ( "AirNewSCR_Conectar_Veiculo", localPlayer, AirNewSCR_Veiculo_Slot_01, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "2" then triggerServerEvent ( "AirNewSCR_Conectar_Veiculo", localPlayer, AirNewSCR_Veiculo_Slot_02, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "3" then triggerServerEvent ( "AirNewSCR_Conectar_Veiculo", localPlayer, AirNewSCR_Veiculo_Slot_03, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "4" then triggerServerEvent ( "AirNewSCR_Conectar_Veiculo", localPlayer, AirNewSCR_Veiculo_Slot_04, Veiculo_Selecionado_Client ) end elseif Posicao_Mouse ( x*471, y*331, x*425, y*27 ) then -- Salvar Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then triggerServerEvent ( "AirNewSCR_SalvarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "2" then triggerServerEvent ( "AirNewSCR_SalvarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "3" then triggerServerEvent ( "AirNewSCR_SalvarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "4" then triggerServerEvent ( "AirNewSCR_SalvarVeiculo", localPlayer, Veiculo_Selecionado_Client ) end elseif Posicao_Mouse ( x*471, y*361, x*425, y*27 ) then -- Vender Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then triggerServerEvent ( "AirNewSCR_VenderVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "2" then triggerServerEvent ( "AirNewSCR_VenderVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "3" then triggerServerEvent ( "AirNewSCR_VenderVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "4" then triggerServerEvent ( "AirNewSCR_VenderVeiculo", localPlayer, Veiculo_Selecionado_Client ) end setElementData ( localPlayer, "Painel-Config", "0" ) elseif Posicao_Mouse ( x*471, y*391, x*425, y*27 ) then -- Trancar / Destrancar Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then triggerServerEvent ( "AirNewSCR_TrancarDestrancarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "2" then triggerServerEvent ( "AirNewSCR_TrancarDestrancarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "3" then triggerServerEvent ( "AirNewSCR_TrancarDestrancarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "4" then triggerServerEvent ( "AirNewSCR_TrancarDestrancarVeiculo", localPlayer, Veiculo_Selecionado_Client ) end elseif Posicao_Mouse ( x*471, y*421, x*425, y*27 ) then -- Localizar / Deslocalizar Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then if getElementData ( localPlayer, "AirNew_Localizador_Data_01" ) == true then triggerServerEvent ( "AirNewSCR_DeslocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_01", false ) else triggerServerEvent ( "AirNewSCR_LocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_01", true ) end elseif Veiculo_Selecionado_Client == "2" then if getElementData ( localPlayer, "AirNew_Localizador_Data_02" ) == true then triggerServerEvent ( "AirNewSCR_DeslocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_02", false ) else triggerServerEvent ( "AirNewSCR_LocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_02", true ) end elseif Veiculo_Selecionado_Client == "3" then if getElementData ( localPlayer, "AirNew_Localizador_Data_03" ) == true then triggerServerEvent ( "AirNewSCR_DeslocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_03", false ) else triggerServerEvent ( "AirNewSCR_LocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_03", true ) end elseif Veiculo_Selecionado_Client == "4" then if getElementData ( localPlayer, "AirNew_Localizador_Data_04" ) == true then triggerServerEvent ( "AirNewSCR_DeslocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_04", false ) else triggerServerEvent ( "AirNewSCR_LocalizarVeiculo", localPlayer, Veiculo_Selecionado_Client ) setElementData ( localPlayer, "AirNew_Localizador_Data_04", true ) end end elseif Posicao_Mouse ( x*47100000000000, y*451, x*425, y*27 ) then -- Expulsar Todos do Veiculo local Veiculo_Selecionado_Client = getElementData ( localPlayer, "AirNewSCR_Veiculo_Selecionado" ) if Veiculo_Selecionado_Client == "1" then triggerServerEvent ( "AirNewSCR_ExpulsarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "2" then triggerServerEvent ( "AirNewSCR_ExpulsarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "3" then triggerServerEvent ( "AirNewSCR_ExpulsarVeiculo", localPlayer, Veiculo_Selecionado_Client ) elseif Veiculo_Selecionado_Client == "4" then triggerServerEvent ( "AirNewSCR_ExpulsarVeiculo", localPlayer, Veiculo_Selecionado_Client ) end elseif Posicao_Mouse ( x*471, y*481, x*425, y*27 ) then -- N/A --outputChatBox ( "-- Nada" ) end end end end end addEventHandler ( "onClientClick", root, SelecionarOpcaoParte1 ) function Posicao_Mouse ( x, y, Largura, Altura ) if not isCursorShowing ( ) then return false end local sx, sy = guiGetScreenSize() local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + Largura) and (cy >= y and cy <= y + Altura) then return true else return false end end -- // Parte Concessionaria // -- local COR_R, COR_G, COR_B, COR_A = 255, 255, 255 local Nomes_Veiculos_Editados = { [545] = 'Fusca'; [559] = 'Voyage'; [429] = 'Gol G4'; [518] = 'Punto'; [546] = 'Corolla'; [600] = 'Saveiro G7'; [587] = 'Honda Civic 2017'; [562] = 'Nissan 350Z'; [475] = 'Camaro SS (Quantidade Limitada)'; [400] = 'Nissan Frontier'; [602] = 'Mustang GT'; [480] = 'Porshe'; [579] = 'Hummer'; [415] = 'Ferrari GTB'; [451] = 'Lamborghini'; [541] = 'Pagani Huayra'; [462] = 'Today'; [586] = 'Titan 160 Dixavada'; [468] = 'XT660'; [521] = 'XJ6 2015'; [522] = 'Z1000'; [463] = 'Harley'; [581] = 'H2R'; } Concessionarias_AirNewSCR = {} local Lista_Veiculos_Concessionarias = { [1] = {ID = { {545, 7000} ,{559, 10500} ,{429, 21000} ,{518, 22000} ,{546, 30000} ,{600, 33000} ,{587, 50000} ,{562, 100000} ,{475, 110000} ,{400, 130000} ,{602, 200000} ,{480, 270000} ,{579, 350000} ,{415, 1800000} ,{451, 3000000} ,{541, 5500000} }, vPosX = -2060.70898, vPosY = 451.06177, -- Posição do Veiculo vPosZ = 141.07220+0.5, PosX = 542.28491, PosY = -1292.54138, PosZ = 16.22188 -0.7, CamX = -2069.44897, CamY = 443.42935, -- Ver de Onde CamZ = 147.51927, lookAtX = -2060.70898, lookAtY = 451.06177, lookAtZ = 141.07220}, [2] = {ID = { {462, 5000} ,{586, 10000} ,{468, 35000} ,{521, 45000} ,{522, 90000} ,{463, 850000} ,{581, 1700000} }, vPosX = 2129.931, vPosY = -1142.089, -- Posição do Veiculo vPosZ = 25.032, PosX = 2131.755, PosY = -1149.22, PosZ = 24.29 -1.5, CamX = 2129.428, CamY = -1134.534, -- Ver de Onde CamZ = 25.62+3, lookAtX = 2129.931, lookAtY = -1142.089, lookAtZ = 25.032} } AirNewSCR_Concessionaria = false function LojaVeiculosDX () dxDrawRectangle(x*18, y*184, x*382, y*400, tocolor(170, 170, 170), false) dxDrawRectangle(x*18, y*184, x*382, y*22, tocolor(100, 100, 100), false) dxDrawText("Loja de Veiculos", x*18, y*184, x*400, y*206, tocolor(255, 255, 255, 255), x*1.00, font, "center", "center", false, false, false, false, false) if Posicao_Mouse ( x*35, y*530, x*126, y*39 ) then dxDrawRectangle(x*35, y*530, x*126, y*39, tocolor(16, 111, 231, 220), false) else dxDrawRectangle(x*35, y*530, x*126, y*39, tocolor(16, 111, 231, 160), false) end dxDrawText("Comprar", x*32, y*385, x*164, y*715, tocolor(255, 255, 255, 255), x*1.00, font, "center", "center", false, false, false, false, false) if Posicao_Mouse ( x*250, y*530, x*126, y*39 ) then dxDrawRectangle(x*250, y*530, x*126, y*39, tocolor(16, 111, 231, 220), false) else dxDrawRectangle(x*250, y*530, x*126, y*39, tocolor(16, 111, 231, 160), false) end dxDrawText("Fechar", x*248, y*385, x*376, y*715, tocolor(255, 255, 255, 255), x*1.00, font, "center", "center", false, false, false, false, false) end GridListLoja = guiCreateGridList( x*28, y*216, x*358, y*300, false) guiGridListSetSelectionMode(GridListLoja, 0) carColumn = guiGridListAddColumn(GridListLoja, "Veículo", 0.4) costColumn = guiGridListAddColumn(GridListLoja, "Preço ($)", 0.4) guiSetVisible ( GridListLoja, false ) FecharLoja = guiCreateButton( x*250, y*530, x*126, y*39, "Fechar", false) guiSetVisible ( FecharLoja, false ) guiSetAlpha ( FecharLoja, 0.00 ) ComprarLoja = guiCreateButton ( x*35, y*530, x*126, y*39, "Comprar", false) guiSetVisible ( ComprarLoja, false ) guiSetAlpha ( ComprarLoja, 0.00 ) for i, M in ipairs(Lista_Veiculos_Concessionarias) do Marker_Concessionarias = createMarker(M["PosX"], M["PosY"], M["PosZ"], "cylinder", 1.2, 16, 111, 231, 160 ) Concessionarias_AirNewSCR[Marker_Concessionarias] = true setElementData ( Marker_Concessionarias, "LojaNumeroID", i ) setElementID(Marker_Concessionarias, tostring(i)) createBlipAttachedTo(Marker_Concessionarias, 55, 2, 255, 255, 255, 255, 0, 150) end function getVehicleModelFromNewName (name) for i,v in pairs ( Nomes_Veiculos_Editados ) do if v == name then return i end end return false end addEventHandler("onClientGUIClick", resourceRoot, function() if source == GridListLoja then local Nome_do_Veiculo = guiGridListGetItemText(GridListLoja, guiGridListGetSelectedItem(GridListLoja), 1) local Preco_do_Veiculo = guiGridListGetItemText(GridListLoja, guiGridListGetSelectedItem(GridListLoja), 2) if guiGridListGetSelectedItem(GridListLoja) ~= -1 then local ID_do_Veiculo = getVehicleModelFromNewName(Nome_do_Veiculo) or getVehicleModelFromName(Nome_do_Veiculo) if isElement(VeiculoAmostra) then setElementModel(VeiculoAmostra, ID_do_Veiculo) return end VeiculoAmostra = createVehicle(ID_do_Veiculo, Lista_Veiculos_Concessionarias["vPosX"], Lista_Veiculos_Concessionarias["vPosY"], Lista_Veiculos_Concessionarias["vPosZ"]) setVehicleDamageProof(VeiculoAmostra, true) setElementFrozen(VeiculoAmostra, true) setElementDimension ( VeiculoAmostra, 1 ) setVehicleColor(VeiculoAmostra, COR_R, COR_G, COR_B, COR_A ) timer = setTimer(function() local x, y, z = getElementRotation(VeiculoAmostra) setElementRotation(VeiculoAmostra, x, y, z-1) end, 50, 0) else if isElement(VeiculoAmostra) then destroyElement(VeiculoAmostra) end if isTimer(timer) then killTimer(timer) end end elseif source == ComprarLoja then if guiGridListGetSelectedItem(GridListLoja) then local Nome_do_Veiculo = guiGridListGetItemText(GridListLoja, guiGridListGetSelectedItem(GridListLoja), 1) local ID_do_Veiculo = getVehicleModelFromNewName(Nome_do_Veiculo) or getVehicleModelFromName(Nome_do_Veiculo) or "boolean" local Preco_do_Veiculo = guiGridListGetItemText (GridListLoja, guiGridListGetSelectedItem(GridListLoja), 2) local Dinheiro = getPlayerMoney ( localPlayer ) if ID_do_Veiculo == "boolean" then triggerServerEvent ( "AirNewSCR_MSGDX", localPlayer, "Selecione um Veiculo antes de Clicar em Comprar!", "error" ) else triggerServerEvent ( "AirNewSCR_ComprarVeiculo", localPlayer, ID_do_Veiculo, Preco_do_Veiculo, COR_R, COR_G, COR_B, COR_A ) AbrirFecharGUIDX () -- Fechar fadeCamera(false, 1.0) setTimer(function() fadeCamera(true, 0.5) setCameraTarget(localPlayer) end, 1000, 1) if isElement(VeiculoAmostra) then destroyElement(VeiculoAmostra) end if isTimer(timer) then killTimer(timer) end end end elseif source == FecharLoja then if AirNewSCR_Concessionaria == true then AbrirFecharGUIDX () -- Fechar fadeCamera(false, 1.0) setTimer(function() fadeCamera(true, 0.5) setCameraTarget(localPlayer) end, 1000, 1) if isElement(VeiculoAmostra) then destroyElement(VeiculoAmostra) end if isTimer(timer) then killTimer(timer) end end end end) local components = { "radar" } function AbrirFecharGUIDX () if AirNewSCR_Concessionaria == false then addEventHandler ( "onClientRender", root, LojaVeiculosDX ) showCursor ( true ) guiSetVisible ( FecharLoja, true ) guiSetVisible ( GridListLoja, true ) guiSetVisible ( ComprarLoja, true ) AirNewSCR_Concessionaria = true setElementFrozen ( localPlayer, true ) setElementDimension ( localPlayer, 1 ) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end else removeEventHandler ( "onClientRender", root, LojaVeiculosDX ) showCursor ( false ) guiSetVisible ( FecharLoja, false ) guiSetVisible ( GridListLoja, false ) guiSetVisible ( ComprarLoja, false ) AirNewSCR_Concessionaria = false setElementData ( localPlayer, "Concessionaria", false ) setElementDimension ( localPlayer, 0 ) setTimer(function() setElementFrozen ( localPlayer, false ) end, 1001, 1) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end end addEventHandler("onClientMarkerHit", resourceRoot, function(player) if not isPedOnGround ( localPlayer ) then return end if getElementType(player) ~= "player" or player ~= localPlayer or isPedInVehicle(player) then return end if Concessionarias_AirNewSCR[source] then i = tonumber(getElementID(source)) guiGridListClear(GridListLoja) for i, v in ipairs(Lista_Veiculos_Concessionarias["ID"]) do local Nome_do_Veiculo = Nomes_Veiculos_Editados[ v[1] ] or getVehicleNameFromModel(v[1]) local row = guiGridListAddRow(GridListLoja) guiGridListSetItemText(GridListLoja, row, 1, Nome_do_Veiculo, false, true) guiGridListSetItemText(GridListLoja, row, 2, tostring(v[2]), false, true) end LocalID = getElementData ( source, "LojaNumeroID" ) setElementData ( localPlayer, "Concessionaria", LocalID ) setTimer(function() setCameraMatrix(Lista_Veiculos_Concessionarias["CamX"], Lista_Veiculos_Concessionarias["CamY"], Lista_Veiculos_Concessionarias["CamZ"], Lista_Veiculos_Concessionarias["lookAtX"], Lista_Veiculos_Concessionarias["lookAtY"], Lista_Veiculos_Concessionarias["lookAtZ"]) AbrirFecharGUIDX () -- Abrir guiGridListSetSelectedItem(GridListLoja, 0, 1) local Nome_do_Veiculo = guiGridListGetItemText(GridListLoja, 0, 1) local ID_do_Veiculo = getVehicleModelFromNewName(Nome_do_Veiculo) or getVehicleModelFromName(Nome_do_Veiculo) local x, y, z = Lista_Veiculos_Concessionarias["vPosX"], Lista_Veiculos_Concessionarias["vPosY"], Lista_Veiculos_Concessionarias["vPosZ"] if isElement(VeiculoAmostra) then destroyElement(VeiculoAmostra) end if isTimer(timer) then killTimer(timer) end VeiculoAmostra = createVehicle ( ID_do_Veiculo, x, y, z ) -- Criar Veiculo setVehicleDamageProof ( VeiculoAmostra, true ) -- Blindar setElementFrozen ( VeiculoAmostra, true ) -- Congelar setVehicleColor ( VeiculoAmostra, COR_R, COR_G, COR_B, COR_A ) -- Pintar setElementDimension ( VeiculoAmostra, 1 ) timer = setTimer ( function() local x, y, z = getElementRotation ( VeiculoAmostra ) setElementRotation ( VeiculoAmostra, x, y, z-1 ) end, 50, 0 ) -- Rotacionar Veiculo end, 400, 1 ) end end)
  7. guiCreateWindow guiSetVisible guiCreateButton bindKey -- ou addCommandHandler showCursor getPedWeapon -- getElementsByType getPlayerName guiCreateGridList guiGridListAddColumn guiGridListAddRow -- Ou guiCreateEdit guiGetText getPlayerFromName --evento "onClientGUIClick" addEventHandler triggerServerEvent giveWeapon getPlayerMoney takePlayerMoney Essas são a funções.
  8. Tentei entender se tem uma diferença grande o suficiente para utilizar esse método no lugar das funções de codificação do próprio MTA. Mas pelo que entendi não muda muito. Tenho o mesmo ponto de visto do Malignos, poderia fazê-lo evitando o uso de banda e utilizando a função encodeString com uma função de hash para a criptografia dos dados e decodeString para obter os dados originais. As funções que citei seriam apropriadas para proteger no cache, em específico, do cliente. Já quanto a um resource vazado, creio que uma proteção efetiva seja hospedar esses arquivos, obtê-los no servidor e aplicando uma criptografia no raw data. Também tem outras formas de proteção, mas acredito que essa seja funcional e não é algo complexo de se fazer. Eu também pensei numa forma assim em vez do server IP. Mas de qualquer forma, o ponto fraco pela conclusão que cheguei não é método do fetchRemote e sim a vulnerabilidade das funções. Só que, comparando com a verificação do IP, sim é mais seguro.
  9. Leia: https://wiki.multitheftauto.com/wiki/PT-BR/Introdução_ao_Scripting E também: https://wiki.multitheftauto.com/wiki/O_arquivo_Meta
  10. For MTA's SQL (registry.db) use executeSQLQuery instead For internal.db you must use account functions - get/setAccountData. EDIT: db functions store data in a local or external database.
  11. Faça em cima do código que o Jonas postou, o seu código está totalmente errado. Basta pedir ajuda pra adicionar a verificação do estado do veículo dentro do código dele. No código dele é só remover a verificação isElementWithinMarker e adicionar a verificação com getElementHealth que você terá o que precisa.
  12. Também dá, só não vai dar stop no resource (cancelando o evento), em vez disso iria chamar uma função (da forma convencional ou com loadstring). E se a verificação falhar não chama; então esse código/função teria que ser a base do script. Talvez seria viável - impedindo o resource de ser iniciado caso não seja pelo comando especificado, mas ainda teria a questão de sobrescrever funções e de segurança, getCommandHandlers mostra todos comandos do servidor e iria vazar esse comando privado. Não entendi por que não deixar o sistema de proteção que te ajudei pra tentar fazer de outra forma que não irá mudar em nada.
  13. That's probably what you mean: function setTeamCmd( player ) local team = getPlayerTeam(player) if team and getTeamName(team) == "Law Enforcement" then addPedClothes ( player, "policetr", "policetr", 17 ) end end addCommandHandler ( "cloth", setTeamCmd ) It's hard to figure out what you want to achieve because you didn't explain it at all. Next time you ask for help provide some informations, it's not always that someone will give you the full code.
  14. Você precisa do resource que substitui a textura, ele precisa estar ligado.
  15. Procure em https://community.multitheftauto.com/ ou pela internet. Próxima vez, quando postar veja qual a seção correta @Osahiro
  16. Quantas horas você estuda por dia não tem muita relevância, é uma questão pessoal: se você é alguém que gosta mais de estudar em vez de diversão/entretenimento creio que terá mais interesse para gastar mais tempo aprendendo, senão, nem vale a pena forçar a barra visto que o importante é você assimilar as coisas. Então o que realmente importa é: você conseguir entender tudo aquilo que estudar, e, de forma alguma estudar corrido sem entender por completo. Outra coisa, algo vital pra quem está estudando é ao mesmo tempo colocar em prática, não fique só na teoria. Entrar em pequenos projetos também te ajudará no progresso e o projeto em si pode te motivar a buscar mais conhecimento e aprender novas coisas.
  17. As long as source is a valid value this should work: setPedAnimation(source, "cop_ambient", "copbrowse_loop",5000,true,false,false) setTimer(function( thePlayer ) setPedAnimation(thePlayer) end, 5000, 1, source) You can use it this way as well: setPedAnimation(source, "cop_ambient", "copbrowse_loop",5000,true,false,false) setTimer( setPedAnimation, 5000, 1, source )
  18. Falta verificar se a mensagem é do comando say, e em vez de criar um elemento de colisão, sugiro utilizar a função getDistanceBetweenPoints3D. Talvez seja este mesmo resource que você está procurando: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2801 Se não for, imagino que seja isto: local chatRadius = 20 addEventHandler( "onPlayerChat", root, function (message, messageType) if messageType == 0 then local x,y,z = getElementPosition(source) cancelEvent() for i,player in ipairs(getElementsByType("player")) do local npx, npy, npz = getElementPosition(player) if getDistanceBetweenPoints3D(x,y,z, npx,npy,npz) <= chatRadius then outputChatBox("#838B83[ #FFFF00вcɢ ʟᴏᴄᴀʟ #838B83]"..getPlayerName(source).."#FFFF00 : #ffffff"..message, player, 255, 255, 255, true) end end end end )
  19. Oh, you want it to change the vehicle's visibility (not the player skin/ped). Try this: addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( source ) == 0 then setElementAlpha ( source, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) addEventHandler("onVehicleEnter", root, function( thePlayer, seat, jacked ) if getElementAlpha( source ) ~= 0 then setElementAlpha ( source, 0 ) outputChatBox ( "Alpha Auto set to 0", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end)
  20. addEventHandler("onVehicleExit", root, function( thePlayer, seat, jacked ) if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 255 ) outputChatBox ( "Alpha Auto set to 255", thePlayer, 0, 255, 0, true ) else outputChatBox ( "Unknoown Error",thePlayer, 255, 0, 0, true ) end end) Try it.
  21. > function team( player ) local g_team = getTeamFromName( "Law Enforcement" ) setPlayerTeam(player, g_team) setTeamFriendlyFire(g_team, false) addPedClothes ( player, "policetr", "policetr", 17 ) end addCommandHandler ( "cloth", team )
  22. You didn't fixed the erros I mentioned. Try this: function team( player ) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Law Enforcement")) then local g_team = getTeamFromName( "team_name_here" ) setPlayerTeam(player, g_team) setTeamFriendlyFire(g_team, false) addPedClothes ( player, "policetr", "policetr", 17 ) end end addCommandHandler ( "cloth", team ) Don't forget to define the team name. You must also have the acl group "Law Enforcement" created; or define an existing one.
  23. Esses erros costumam ser do servidor... estranho. Nesse caso, faça este procedimento aqui: Ou reinstale o seu MTA. EDIT: Se não funcionar, por favor, baixe e execute o MTA Diag e cole o link gerado após a verificação aqui.
  24. The event "onPlayerTeamChange" doesn't exist (although it would be useful if it's implemented in MTA). You also have some errors in your code, like: - A parenthesis missing at the beginning of the function. - An extra parenthesis at the end of the function. - 'account' and 'team' not defined Next time remember to post your code using the button <> and select the appropriate code language (ie: Lua). Read: https://forum.multitheftauto.com/topic/94790-guidelines-and-formatting-for-this-section-read-before-posting/
×
×
  • Create New...