Jump to content

rxqp

Members
  • Posts

    25
  • Joined

  • Last visited

Recent Profile Visitors

573 profile views

rxqp's Achievements

Advanced Member

Advanced Member (8/54)

1

Reputation

  1. O source do evento onVehicleEnter e o veiculo, use uma condição para saber se o veiculo no qual ele entrou e o veiculo de trabalho do mesmo ex function Exit_Veh (source) if getElementData(source, "Viagem") == true then exports.Scripts_Dxmessages:outputDx(source, "Você tem 60 segundos para voltar pro caminhão", "warning") Tempo[source] = setTimer ( function() canceljobtimer (source) setElementData(source, "Viagem", false) exports.Scripts_Dxmessages:outputDx(source, "Você Saiu da Van, Mercadoria Cancelada!", "warning") end, 10000, 1 ) end end addEventHandler ("onVehicleExit", getRootElement(), Exit_Veh) function Enter_Veh (player) if (Caminhao[player]) and isElement(Caminhao[player]) then if source == [[--(var do veiculo do player)--]] then if isTimer(Tempo[source]) then killTimer(Tempo[source]) exports.Scripts_Dxmessages:outputDx(source, "Você voltou pro seu veículo", "warning") end end end end addEventHandler ("onVehicleEnter", getRootElement(), Enter_Veh)
  2. vc pode usar a função util isEventHandlerAdded pra verificar se o painel esta renderizando (lembrando que e uma função util) ex addEventHandler("onClientKey", root, function (button, press) if isEventHandlerAdded("onClientRender", getRootElement(), LoginPanel) then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" then cancelEvent() end end end) Lembrando que quando for fazer a verificação de um valor boolean, não e nescessario inserir a condição, apenas com o if (verificação) then ele reconhece que caso o valor seja true para continuar essa função obs: use no client (mude a função do isEventHandlerAdded)
  3. Sim, geralmente as unicas alterações nesses mods de voice e a distancia, icon ou dx (Nao sei dar reply)
  4. Exemplo abaixo: markers = { [1] = {x, y, z}, [2] = {x, y, z}, [3] = {x, y, z}, [4] = {x, y, z}, } addCommandHandler("command", function(source) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) then local number = math.random(1, 4) marker = createMarker(markers[number][1], markers[number][2], markers[number][3], "cylinder", 2.0, 255, 255, 255) blip = createBlipAttachedTo(marker, 10) end end) addCommandHandler("destroymarker", function(source) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) then if isElement(marker) then destroyElement(marker) end end end)
  5. Edit: O outputChatBox pode bugar por estar sendo usado dentro de um for, vc pode usar esta função para pegar os players proximos function pegarPlayersProximos(elemento) if isElement(elemento) and getElementType(elemento) then for i, v in ipairs(getElementsByType("player")) do if v ~= elemento then local x, y, z = getElementPosition(elemento) local x2, y2, z2 = getElementPosition(v) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 3 then end return v end end end end
  6. Exemplo: config = { markerInicio = {x, y, z}, } markers = { [1] = {x, y, z}, [2] = {x, y, z}, } marker = createMarker(config.markerInicio[1], config.markerInicio[2], config.markerInicio[3], "cylinder", 2.0, 255, 255, 255) addEventHandler("onMarkerHit", marker, function(source) if getPedOccupiedVehicle(source) then outputChatBox("Use /corrida para iniciar a corrida") end end) addCommandHandler("corrida", function(source) if isElementWithinMarker(source, marker) then setElementPosition(source, x, y, z) veh = createVehicle(vehicleID, x, y, z) warpPedIntoVehicle(source, veh) setElementData(source, "Augusto.Marker", 1) criarMarker(source) end end function criarMarker(element) if isElement(element) then local number = tonumber((getElementData(element, "Augusto.Marker") or 1)) local x, y, z = markers[number][1], markers[number][2], markers[number][3] markerCheckpoint = createMarker(x, y, z , "checkpoint", 2.0, 255, 255, 255) addEventHandler("onMarkerHit", markerCheckpoint, function(source) if source == element then setElementData(source, "Augusto.marker", number +1) destroyElement(markerCheckpoint) criarMarker(source) end end) end end Obs: Não testei lembrando que voce pode usar a condição "until" (ate) para verificar se acabou os checkpoints
  7. Exemplo: (Acabei de fazer) addCommandHandle("local", function(source, commandName, ...) local msg = table.concat({...}, " ") if not (...) then return end for i, v in ipairs(getElementsByType("player")) do if v ~= source then local x, y, z = getElementPosition(source) local x2, y2, z2 = getElementPosition(v) if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 3 then outputChatBox("[MENSAGEM LOCAL] "..getPlayerName(source)..": "..msg, v, 255, 255, 255, true) end end end end Obs: E nescessario testar
  8. Voce consegue alterar todas as configurações do voice na mtaserver.conf Diretorio: C:/Program Files (x86)/MTA San Andreas 1.5/server/mods/deathmatch/
  9. A função onClientRender (como vc provavelmente sabe) fica sempre sendo executada (enquanto o evento estiver ativo) voce pode criar um dxEditBox pra verificar a caixinha de edit, vc usa condições dentro do onClientRender pra isso, ex: local pID = createElement("Augusto.playerId") addEventHandler("onClientRender", getRootElement(), function() local playerID = getElementData(pID, "text2") or "" --text2 e o elemento padrão de texto do dxEditBox if getPlayerID(tonumber(playerId)) then --Nesta condição, o script encontrou o id especificado na caixinha do dxEditBox else --Aqui não encontrou as informações dxDrawText("Não Encontrado", w, h, x, y) end end) Espero que tenha conseguido entender : )
  10. Provavel que no client-side da hud, as variaveis de fome e sede podem n ser reconhecidas, vou deixar 2 exemplo abaixo local fome = getElementData(localPlayer, "Augusto.fome") local sede = getElementData(localPlayer, "Augusto.sede") neste codigo acima, ele so indentificara o elemento caso o player tenha, caso ele não tenha retornara nil, isso que pode estar causando o problema, de uma olhada no codigo e altere para isso local fome = getElementData(localPlayer, "Augusto.fome") or 0 local sede = getElementData(localPlayer, "Augusto.sede") or 0 caso o script nao consiga indentificar esses elementos no player, ele tem uma segunda opção (or/ou)
  11. Vc pode pegar a posição do veiculo em uma variavel local e setar a position do player de acordo com essa posição Exemplo Simples: addCommandHandler("sair", function(source) if isPlayerAttachedInVehicle(source) then local pVeh = playerVehicle local x, y, z = getElementPosition(pVeh) detachElements(source, pVeh) setElementPosition(source, x, y +2, z) end end) Obs: Na suposição, isPlayerAttachedInVehicle seria uma função util e playerVehicle, uma variavel setada no comando de agarrar, mas tmb pode ser utilizado elementData (menos eficiente por ser um script "global" (usado em todo o servidor) pois caso o servidor tenha muitos players pode acarretar lag
  12. Um exemplo de banimento por quitar algemado: addEventHandler("onPlayerQuit", root, function(quitType) if quitType == "Quit" then if getElementData(source, "Augusto.Algemado") then banPlayer(source, true, false, false, "Servidor", "Deslogou Algemado", 600000) --10 Minutos end end end)
  13. Bom dia/tarde/noite, estou tentando programar um launcher para mta (em csharp), queria saber se alguem conhece algum request do mta que abra o processo e conecte-se a um servidor igual ao fivem Ex do fivem System.Diagnostics.Process.Start($"fivem://connect/IPDOSERVIDOR");
  14. Preciso que renasça um ped apos o cara passar por um certo marker, alguem sabe uma função, procurei pela mta wiki em ped functions e n achei alguma que funcionasse Como ainda (depois de meses) nao sei editar o topico, eu ja consegui fazer com que eles renasçam mas da pra bugar o sistema, alguem sabe se da (adicionando na acl Admin) pra reiniciar o script apos o cara pisar no marker? Motivo de dar para bugar: function finalizar(source) if isPedDead(alvo1) then if isPedDead(alvo2) then if isPedDead(alvo3) then if isPedDead(alvo4) then if isPedDead(alvo5) then if isPedDead(alvo6) then if isPedDead(alvo7) then if isPedDead(alvo8) then if isPedDead(alvo9) then if isPedDead(alvo10) then setElementFrozen(source, false) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) outputChatBox("Va ate a porta para sair do treinamento", localPlayer, 0, 255, 255, true) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) end end end end end end end end end end end addCommandHandler("finalizar", finalizar) Obs: da pra dar finalizar mesmo sem matar os peds depois que eles sao setados (setElementHealth) com 100 de vida Como ainda (depois de meses) nao sei editar o topico, eu ja consegui fazer com que eles renasçam mas da pra bugar o sistema, alguem sabe se da (adicionando na acl Admin) pra reiniciar o script apos o cara pisar no marker? Motivo de dar para bugar: function finalizar(source) if isPedDead(alvo1) then if isPedDead(alvo2) then if isPedDead(alvo3) then if isPedDead(alvo4) then if isPedDead(alvo5) then if isPedDead(alvo6) then if isPedDead(alvo7) then if isPedDead(alvo8) then if isPedDead(alvo9) then if isPedDead(alvo10) then setElementFrozen(source, false) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) outputChatBox("Va ate a porta para sair do treinamento", localPlayer, 0, 255, 255, true) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) end end end end end end end end end end end addCommandHandler("finalizar", finalizar) Obs: da pra dar finalizar mesmo sem matar os peds depois que eles sao setados (setElementHealth) com 100 de vida Como ainda (depois de meses) nao sei editar o topico, eu ja consegui fazer com que eles renasçam mas da pra bugar o sistema, alguem sabe se da (adicionando na acl Admin) pra reiniciar o script apos o cara pisar no marker? Motivo de dar para bugar: function finalizar(source) if isPedDead(alvo1) then if isPedDead(alvo2) then if isPedDead(alvo3) then if isPedDead(alvo4) then if isPedDead(alvo5) then if isPedDead(alvo6) then if isPedDead(alvo7) then if isPedDead(alvo8) then if isPedDead(alvo9) then if isPedDead(alvo10) then setElementFrozen(source, false) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) outputChatBox("Va ate a porta para sair do treinamento", localPlayer, 0, 255, 255, true) outputChatBox("---------------------------", localPlayer, 0, 255, 255, true) end end end end end end end end end end end addCommandHandler("finalizar", finalizar) Obs: da pra dar finalizar mesmo sem matar os peds depois que eles sao setados (setElementHealth) com 100 de vida
×
×
  • Create New...