Jump to content

HiroShi

Members
  • Posts

    73
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by HiroShi

  1. Olá @SciptNovato, basta você no meta, que já percebe um problema. O arquivo server_S.lua, está sendo iniciado antes do client.lua, recomendo você usar onResourceStart e onClientResourceStart em seus scripts.

    No caso para resolver, tenta coloca client.lua, para iniciar primeiro que o server_S.lua

     

    <meta>
    	<min_mta_version> client='1.5.7' server='1.5.7' />
        <script src='client.lua' type='client' cache='false' />
        <script src='server_S.lua cache='false' />
    </meta>

    desta forma.

  2. 3 hours ago, LucasST said:

    Já fiz testes em empregos que fiz, após destruir o marker não ocorreu nenhum erro mesmo com o evento ainda adicionado.

    mas aí o evento onMarkerHit ficará lá sem sentido algum.

    9 hours ago, ber said:

    Isso já foi testado por você? Porque pela lógica, se não tem mais o marker, não tem como o evento ser acionado.

    isto é apenas um ex.

  3. On 01/01/2021 at 22:33, HotPotato said:

    Tem uma coisa que anda me comovendo, quando nós criamos um elemento (qualquer que seja, ex: checkpoint ) e atribuímos a ele um evento, se destruirmos este elemento (destroyElement) o evento ainda precisa ser apagado? visto que o elemento em si não existe mais... fico pensando se o servidor "guardaria" esses eventos e a memória começar a aumentar por conta de não estar dando dispose deles... tipo quando você faz uma Query e você não da dbFree para liberar a query .. vai gerando um gargalo.

    Pergunto pois em outras linguagens, como o C#, eventos precisam ser desvinculados pois ainda podem ser chamados... mas no MTA, apesar dele não ser "chamavél" será que pode estar lá ainda? podendo gerar impacto na memória ao longo prazo? 

     

    A duvida é se eu preciso dar "removeEventHandler" ou o destroyElement já basta?

    isso vai mudar se for um elemento criado por você ou um já do MTA como: (player, object, vehicle etc..) agora um marker por ex:

    você cria um marker com a váriavel 'MarkerTeste', e cria um evento 'onMarkerHit' ultilzando o 'MarkerTest' é óbvio que se o 'MarkerTeste' vou destruido o evento vai avisar que não está achando ele gerando um ERROR

  4. 28 minutes ago, Saulolno said:

                                                                                                                     Bom dia, tarde ou noite. 

    Estava editando alguns scripts/huds e tentando torna-los compatíveis, porém encontrei alguns problemas, lembrando que sou apenas um iniciante e não tenho conhecimento algum em Script, todos os conhecimentos que obtive foi observando tutoriais  e usando a logica :

    O sistema de fome, Sede e Sono estão incluso na HUD, são funcionais porém, não existe maneira de reabastece-los, ou seja :

    - O Sistema tem sua própria fome, O HUD está sincronizado com a fome ( Ela diminui), igualmente para sede e sono(Apenas repliquei os arquivos e mudei os nomes deixando-os mais logico possível), porém não existe maneira de faze-las retornar ao ''máximo'', ou seja²:

    - O Player não tem uma ''loja'' ou comida para ingerir e nem uma cama pra dormir(Press F to Pay Respect)(Sad dmais).

     

    - Minha ideia inicial era deixar a HUD Oculta e aparecer quando eu pressionar certo botão ''TAB'' (RESOLVIDO)

     

    Aguardo uma resposta para explicar mais detalhes e postar o script/hud se necessário. (claro que vai ser né Saulo) (Não me leve a mal, Apenas preciso sentir que tem alguem do outro lado)



     

    manda o código de sua HUD

  5. 2 hours ago, ber said:
    
    function onClick(button, state)
    	if button == "left" then
    		if state == "down" then
    			tick = getTickCount()
    		elseif state == "up" then
    			if (getTickCount() - tick) >= 3000 then
    				--PROSSIGA SEU SCRIPT AQUI
    			else
    				outputChatBox("Você precisa pressionar o botão por 3 segundos")
    			end
    		end
    	end
    end
    addEventHandler("onClientClick", root, onClick)

     

    isso, desta maneira !. Boa @ber

    • Thanks 1
  6. On 18/12/2020 at 21:08, DrugDrealer said:

    Tentei adicionar essa funçao, porem indiferente a cor que eu seto, e a opacidade o objeto so perdeu a textura e passou a ser branco.

    Imagem de como ficou :

      Hide contents

    lOFVrJA.png

     

    tente achar um shader que faça meio que 'saturação' nas cores

  7. @Boechatmuito bem !. Mas deixarei um exemplo aqui usando o elemento 'player' no getElementsByType().

    Vamos supor que desejamos puxar um player pelo seu ID, então faremos assim:

    print(getPlayerName(getPlayerFromID(23))) -- aqui daremos um print no nome do player que tem o id 23.
    
    function getPlayerFromID(ID) -- aqui é a function que puxa o player pelo ID
    	v = false -- aqui criamos uma variavel que atribuimos o valor boolean 'false'
    	for INDICE, VALOR in ipairs (getElementsByType('player')) do -- aqui iniciamos um loop de todos os players
    		if getElementData(VALOR, "ID") == ID then -- aqui verificamos os players que tem o elementData 'ID' igual o que botamos no print acima
                v = VALOR -- aqui transformamos a variavel no player selecionado.
                break -- aqui quebramos o loop
    		end
    	end
    	return v -- aqui retornamos para o 'print' o 'player or false'
    end

     

    • Like 1
    • Thanks 1
  8. On 21/12/2020 at 16:19, lucasvinicius said:

    Ele é um Script loja de assalto ele esta com alguns problemas então estou pedindo ajuda ele tem como assaltar de 2 jeitos caixa e cofre o Cofre quando assalto ele assalta por 2 segundos eu queria mudar o tempo mas não sei como muda o 2 erro é no caixa que quando assalta ele só solta o alarme eu gostaria que mandasse a masma info do cofre mas não sei mudar no script. 

    Obrigado quem Respondeu.

    Script:

    
    --[[
    
    
    
     ################################################
     #                                              #
     #              Script Criado Por               #
     #           FACEBOOK.COM/AIRNEWSCR             #
     #                                              #
     #                                              #
     ################################################
    
    
    
    --]]
    
    --------------------------------------------------------------------------------------------
    
    InteriorID = 0
    DimensaoID = 0
    BlipSemAssaltoID = 17
    BlipAssaltoEmAndamento = 20
    ValorDoRoubo1 = 4500
    ValorDoRoubo1A = 5500
    TempoDoAssalto = 120000
    
    eX, eY, eZ = 1379.954, -1751.114, 13.547
    sX, sY, sZ = 1375.826, -1751.235, 13.6
    
    --SairX, SairY, SairZ, SairRot = 1852.30701 + 1, -1145.14099, 23.83357, 270
    --EntrX, EntrY, EntrZ, EntrRot = -30.98231, -91.75459 + 1, 1003.54688, 0
    
    AssaltoX, AssaltoY, AssaltoZ = 1377.181, -1745.383, 13.6
    
    AtendID, AtendX, AtendY, AtendZ, AtendRot = 189, 1377.222, -1743.888, 13.6, 176
    
    Rot_z_Roubo = AtendRot + 180
    
    LetraParaMarkers = "f"
    Roubo_Recente_SuperMercadoLS = false
    
    --------------------------------------------------------------------------------------------
    
    --Entrada_SuperMercadoLS = createMarker ( eX, eY, eZ -1, "cylinder", 1.2, 20, 70, 230, 0 )
    BlipEntrada_SuperMercadoLS = createBlipAttachedTo ( Entrada_SuperMercadoLS, BlipSemAssaltoID )
    setBlipVisibleDistance( BlipEntrada_SuperMercadoLS, 150 )
    
    --------------------------------------------------------------------------------------------
    
    --Saida_SuperMercadoLS = createMarker ( sX, sY, sZ -1, "cylinder", 1.2, 20, 70, 230, 95 )
    --setElementInterior ( Saida_SuperMercadoLS, InteriorID )
    --setElementDimension ( Saida_SuperMercadoLS, DimensaoID )
    
    --------------------------------------------------------------------------------------------
    
    local EmAssaltoBlip_SuperMercadoLS = createBlipAttachedTo ( Entrada_SuperMercadoLS, BlipAssaltoEmAndamento )
    setElementVisibleTo ( EmAssaltoBlip_SuperMercadoLS, root, false )
    
    --------------------------------------------------------------------------------------------
    
    Dentro_Assalto_SuperMercadoLS = createMarker ( AssaltoX, AssaltoY, AssaltoZ -1, "cylinder", 1.2, 20, 70, 230, 95 )
    setElementInterior ( Dentro_Assalto_SuperMercadoLS, InteriorID )
    setElementDimension ( Dentro_Assalto_SuperMercadoLS, DimensaoID )
    
    Atendente_SuperMercadoLS = createPed ( AtendID, AtendX, AtendY, AtendZ, AtendRot )
    setElementInterior ( Atendente_SuperMercadoLS, InteriorID )
    setElementDimension ( Atendente_SuperMercadoLS, DimensaoID )
    setElementFrozen ( Atendente_SuperMercadoLS, true )
    
    function RespawnDoAtendente ()
        if isPedDead ( Atendente_SuperMercadoLS ) then
            setTimer(function()
                destroyElement (Atendente_SuperMercadoLS)
                Atendente_SuperMercadoLS = createPed ( AtendID, AtendX, AtendY, AtendZ, AtendRot )
                setElementInterior ( Atendente_SuperMercadoLS, InteriorID )
                setElementDimension ( Atendente_SuperMercadoLS, DimensaoID )
                setElementFrozen ( Atendente_SuperMercadoLS, true )
            end,5000,1,thePlayer)
        end
    end
    addEventHandler( "onPedWasted", getRootElement(), RespawnDoAtendente )
    
    --------------------------------------------------------------------------------------------
    
    function Roubar_SuperMercadoLS ( thePlayer, matchingDimension )
        if isElementWithinMarker ( thePlayer, Dentro_Assalto_SuperMercadoLS ) then
            local wl = getPlayerWantedLevel ( thePlayer )
            local arma = getPedWeapon ( thePlayer )
        	unbindKey ( thePlayer, LetraParaMarkers, "down", Roubar_SuperMercadoLS )                                  -- Remover Bind do Assalto
            exports.Scripts_OnMarkerMsgs_:delete (thePlayer)                                                                                 -- Deletar Mensagem no Meio da Tela
        	if getElementData ( thePlayer, "Policia" ) == true then
        	    return exports.Scripts_Textos:createNewDxMessage ( 'Você é um Policial e não Pode Assaltar Lojas', thePlayer, 255, 255, 255)
        	end
        	if arma == 0 or arma == 1 or arma == 2 or arma == 3 or arma == 4 or arma == 5 or arma == 6 or arma == 7 or arma == 8 or arma == 9 or arma == 16 or arma == 17 or arma == 18 or arma == 39 or arma == 41 or arma == 42 or arma == 43 or arma == 10 or arma == 11 or arma == 12 or arma == 14 or arma == 15 or arma == 44 or arma == 45 or arma == 46 or arma == 40 then
        	    return exports.Scripts_Textos:createNewDxMessage ( 'Você Precisa de uma Arma de Fogo para Assaltar Essa Loja!', thePlayer, 255, 255, 255)
        	end
        	if Roubo_Recente_SuperMercadoLS == false then
    		    setElementRotation ( thePlayer, 0, 0, Rot_z_Roubo )
        	    setPedAnimation ( thePlayer, "SHOP", "SHP_Gun_Aim", -1, true, false, true )                                 -- Fazer a Animação de Assalto ( Jogador )
        	    setPedAnimation ( Atendente_SuperMercadoLS, "SHOP", "SHP_Rob_GiveCash", -1, true, false, true )                  -- Fazer a Animação de Se Render ( BOT )
    	        setTimer(function()
    	            setPedAnimation ( thePlayer )
    	            setPedAnimation ( Atendente_SuperMercadoLS, "SHOP", "SHP_Rob_HandsUp", -1, true, false, true )                   -- Entregar o Dinheiro ( BOT )
    	        end,40000,1,thePlayer)
            if wl < 6 then
    	        setPlayerWantedLevel ( thePlayer, wl+1 )                                                                  	     -- Setar +1 Level de Procurado ( Jogador )
        	end
        	triggerClientEvent ( root, "AirNew>LigarAlarme1", root, thePlayer )                                             -- Disparar o Alarme
            exports.Scripts_Textos:createNewDxMessage ( 'Aguarde 120 Segundos & Você podera Sair da Loja. A Policia Foi Notificada Sobre o Assalto!', thePlayer, 255, 255, 255)
        	setElementData ( thePlayer, "AirNewSCR_Roubo_SuperMercadoLS", true )                            -- setElementData "RouboEmAndamento" ( Jogador ) True
        	Roubo_Recente_SuperMercadoLS = true                                                                                                                      -- Roubo_Recente_SuperMercadoLS = true
        	    setTimer(function()
        	        setElementData ( thePlayer, "AirNewSCR_Roubo_SuperMercadoLS", false )                                             -- setElementData "RouboEmAndamento" ( Jogador ) False
        	        setPedAnimation ( Atendente_SuperMercadoLS )                                                                     -- Remover a Animação ( BOT )
        	        givePlayerMoney ( thePlayer, ValorDoRoubo1 )                                                                 -- Dar Dinheiro ( Jogador )
        	    end,TempoDoAssalto,1,thePlayer)
        	for i, player in ipairs(getElementsByType("player")) do
                local uj = getElementData(player,"Policia") or false
                if type(uj) == "boolean" then
                    if uj == true then
        	            NickName = string.gsub(getPlayerName(thePlayer), "#%x%x%x%x%x%x", "")
                        exports.Scripts_Textos:createNewDxMessage ( "O Jogador "..NickName.." Esta Assaltando uma Loja em Los Santos, Siga o Icone Vermelho no Mapa", player, 255, 255, 255)
        	            setElementVisibleTo ( EmAssaltoBlip_SuperMercadoLS, player, true )
        	            setTimer ( function() setElementVisibleTo ( EmAssaltoBlip_SuperMercadoLS, player, false ) end, 120000, 1, thePlayer )
        	        end
        	    end
        	end
        	else
        	    exports.Scripts_Textos:createNewDxMessage ( 'Essa Loja ja foi Roubada Recentemente!', thePlayer, 255, 255, 255)
        	    setTimer(function()
        	        Roubo_Recente_SuperMercadoLS = false
        	    end,TempoDoAssalto+60000,1,thePlayer)
            end
        end
    end
    
    function emarker(marker,md)
    	if (md) then
    		if marker == Dentro_Assalto_SuperMercadoLS then
    			bindKey ( source, LetraParaMarkers, "down", Roubar_SuperMercadoLS )
    			exports.Scripts_OnMarkerMsgs_:create(source,"Aperte 'f' Parar Efetuar o Assalto") 		
    		elseif marker == Entrada_SuperMercadoLS then
    		    if getElementType ( source ) == "vehicle" then return end
    		    if isPedInVehicle ( source ) then return end
    		    setTimer ( setElementInterior, 400, 1, source, InteriorID )
    		    setTimer ( setElementDimension, 400, 1, source, DimensaoID )
    		    setTimer ( setElementPosition, 400, 1, source, EntrX, EntrY, EntrZ )
    		    setTimer ( setElementRotation, 600, 1, source, 0, 0, EntrRot )
    		    fadeCamera ( source, false, 0.1, 0, 0, 0 )   
    		    setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
    		    setTimer ( setCameraTarget, 600, 1, source )
                setElementData (source, "Entrada_AssaltoLoja", "SuperMercadoLS" )
    		elseif marker == Saida_SuperMercadoLS then
                if getElementType ( source ) == "vehicle" then return end
                if isPedInVehicle ( source ) then return end
                if not getElementData (source, "AirNewSCR_Roubo_SuperMercadoLS" ) == true then
                    setTimer ( setElementInterior, 400, 1, source, 0 )
                    setTimer ( setElementDimension, 400, 1, source, 0 )
    				if getElementData ( source, "Entrada_AssaltoLoja" ) == "SuperMercadoLS" then
                        setTimer ( setElementPosition, 400, 1, source, SairX, SairY, SairZ )
                        setTimer ( setElementRotation, 400, 1, source, 0, 0, SairRot )
    				end
    				fadeCamera ( source, false, 0.1, 0, 0, 0 )   
    				setTimer ( fadeCamera, 600, 1, source , true, 0.5 )
    				setTimer ( setCameraTarget, 600, 1, source )
                else
                    exports.Scripts_Textos:createNewDxMessage ( 'Aguarde o Assalto Terminar para Sair da Loja', source, 255, 255, 255)
                end
    		end
        end	
    end
    addEventHandler ( "onPlayerMarkerHit", getRootElement(), emarker )
    
    function lmarker(marker,md)
    	if (md) then
    		if marker == Dentro_Assalto_SuperMercadoLS then
    			unbindKey ( source, LetraParaMarkers, "down", Roubar_SuperMercadoLS )
    			exports.Scripts_OnMarkerMsgs_:delete(source)
    			setTimer(restartResource, 360000, 1, getThisResource())
    		end
        end
    end
    addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)
    
    --------------------------------------------------- Roubo ao Cofre --------------------------------------------------------------------
    
    local Doorentryrob1 = createMarker(1363.682, -1754.184, 12.6, "cylinder", 1.5, 255, 255, 0, 0)
    createBlipAttachedTo(Doorentryrob1, 17, 2, 0, 255, 0, 0, 0, 7000)
    local robmarker1 = createMarker(1363.682, -1754.184, 12.6, "cylinder", 1.2, 255, 10, 10, 60)
    
    function msg1 (source)
    	outputChatBox ("*Digite /roubar encima da marca vermelha para começar a roubar a loja.",source,255,255,255,true)
    end
    addEventHandler( "onMarkerHit", robmarker1, msg1 )
    
    function duty1(thePlayer, matchingDimension)
      if isElementWithinMarker(thePlayer, robmarker1) then
      
        Estrelas = getPlayerWantedLevel ( thePlayer )
        setPlayerWantedLevel ( thePlayer, Estrelas + 1 )
    	triggerClientEvent ( root, "AirNew>LigarAlarme3", root, thePlayer ) 
        outputChatBox("#10DC6F● #828282[ #10DC6FLojas#828282 ] - #FFFFFFVocê está roubando a loja! aguarde alguns segundos ...", thePlayer, 0, 255, 0, true)
        triggerClientEvent(root, "RoboLoja", root, getPlayerName( thePlayer ) )
      for i, player in ipairs(getElementsByType("player")) do
      if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Policial" ) ) then
        triggerClientEvent(root, "addNotification", root, "ATENÇÃO: ESTÃO ASSALTANDO O SUPERMERCADO AGC PRÓX. A PREFEITURA! ", "warning")
      end
      end
    		setPedAnimation(thePlayer, "ROB_BANK", "CAT_Safe_Rob", -1, false, false, false, false)
    		setElementData(thePlayer, "sitting", true)
    		
        setTimer(Lojalossantos1, 180000, 1)
        setElementPosition(robmarker1, 3099.97, -3281.69, -0.5)
        do
        local aleatorio = math.random(30000,50000)
          local blip1 = createBlipAttachedTo(Doorentryrob1, 20, 2, 0, 255, 0, 0, 0, 7000)
          setTimer(setElementPosition, 420000, 1, robmarker1, 1363.682, -1754.184, 12.6)
          setTimer(function()
        local dsujasso = tonumber(aclGetGroup ( "Gang" )) or 0
            aclGetGroup(thePlayer, "Gang", dsujasso+aleatorio)
          end, 40000, 1)
          setTimer(destroyElement, 420000, 1, blip1)
          givePlayerMoney ( thePlayer, ValorDoRoubo1A )
        end
      else
        outputChatBox("", source, 255, 0, 0)
    	setTimer(restartResource, 360000, 1, getThisResource())
      end
    end
    addCommandHandler("roubar", duty1)
    
    function Doorerob1(player)
      if source == Doorentryrob1 and getElementType(player) == "player" then
        if (getElementType(player) == "player") then
        local vehicle = getPedOccupiedVehicle(player)
        local playerAccount = getPlayerAccount(player)
          if (not vehicle) then
            if (playerAccount) then
              if (not isGuestAccount(playerAccount)) then
              end
            end
          end
        end
    end
    end
    addEventHandler("onMarkerHit", getRootElement(), Doorerob1)
    
    -------------------------------------------------------------------------------------------------------------------------------------------------
    
    function SaveSuperMercadoLSEntrada(conta)
    	if conta then
    		local source = getAccountPlayer(conta)
    		local emp = getElementData(source,"Entrada_AssaltoLoja" ) or false
    		setAccountData (conta, "Entrada_AssaltoLoja",emp)
    	end	
    end
    
    function LoadSuperMercadoLSEntrada(conta)
    	if not (isGuestAccount (conta)) then
    		if (conta) then	
    			local source = getAccountPlayer(conta)	
    			local emp = getAccountData(conta,"Entrada_AssaltoLoja") or false
    			setElementData (source, "Entrada_AssaltoLoja", emp)
    		end
    	end	
    end
    
    --------------------------------------------------------------------------------------------
    
    addEventHandler("onPlayerLogin", root,
      function( _, acc )
    	setTimer(LoadSuperMercadoLSEntrada,50,1,acc)
      end
    )
    
    function IniciarScriptTeleSuperMercadoLS ( res )
    	if res == getThisResource() then
    		for i, player in ipairs(getElementsByType("player")) do
    			local acc = getPlayerAccount(player)
    			if not isGuestAccount(acc) then
    				LoadSuperMercadoLSEntrada(acc)
    			end
    		end
    	end
    end
    addEventHandler ( "onResourceStart", getRootElement(), IniciarScriptTeleSuperMercadoLS )
    
    function DesligarScriptTeleSuperMercadoLS ( res )
        if res == getThisResource() then
    		for i, player in ipairs(getElementsByType("player")) do
    			local acc = getPlayerAccount(player)
    			if not isGuestAccount(acc) then
    				SaveSuperMercadoLSEntrada(acc)
    			end
    		end
    	end
    end 
    addEventHandler ( "onResourceStop", getRootElement(), DesligarScriptTeleSuperMercadoLS )
    
    function SairScriptTeleSuperMercadoLS ( quitType )
    	local acc = getPlayerAccount(source)
    	if not (isGuestAccount (acc)) then
    		if acc then
    			SaveSuperMercadoLSEntrada(acc)
    		end
    	end
    end
    addEventHandler ( "onPlayerQuit", getRootElement(), SairScriptTeleSuperMercadoLS )
    
    --------------------------------------------------------------------------------------------

     

    Infelizmente não tem como lhe ajudar assim :/, você que deve arrumar seu código, aqui nós só compartilhamos ideias e repondemos dúvidas.

  9. On 22/12/2020 at 22:37, [N]inja said:

    n pegou colocando both

    local pressing = false
    
    bindKey("k", "both", function(_, state)
        if state == "down" then
            if not pressing then
                pressing = getTickCount()
            end
        elseif state == "up" then
            if pressing and pressing + 3000 >= getTickCount() then
                pressing = false
                outputChatBox("* Erro: você deve segurar por 3 segundos.", 255, 0, 0)
            else
                pressing = false
                -- executa a função que você quer
            end
        end
    end)

    pega este exemplo tente elaborar uma lógica.

    • Thanks 1
  10. 9 hours ago, ber said:
    
    function onWasted()
    	local skin = getElementModel(source)
    	spawnPlayer(source, x, y, z, 0, skin, 0, 0)
    end
    addEventHandler("onPlayerWasted", root, onWasted)

    Procure uma função parecida com essa no seu script, e antes do spawnPlayer, crie uma variável para pegar a skin atual do player e coloque-a no spawnPlayer. Isso resolverá seu problema

    isso !

    • Thanks 1
  11. 9 hours ago, ber said:

    Estou com um problema em meu servidor, onde as vezes (bem raro) quando o player entra em um interior, ele fica caindo no limbo infinitamente, e não para mesmo se relogar, a única maneira de parar é puxar ele através do painel P. Como meu servidor é focado para ser super leve, imagino que o problema seja que o setElementPosition acaba sendo mais rápido que a renderização do interior, fazendo com que ele passe do chão e fique caindo sem parar, acho bem provável ser isso pois o PC da maioria dos players é bem fraco.

    Atualmente, essa é a função que eu uso para mover o player para um interior:

    
    function Enter(playerSource)
    	if getElementType(playerSource) == "player" then
    		if getElementDimension(playerSource) == 0 and getElementInterior(playerSource) == 0 then
    			if not isPedInVehicle(playerSource) then
    				fadeCamera(playerSource, false, 0.5)
    				setTimer(function(playerSource) 
    					setElementInterior(playerSource, 0)
    					setElementDimension(playerSource, 0)
    					setElementPosition(playerSource, 1040.612, -1015.891, -47.559)
    					setElementRotation(playerSource, 0, 0, 90)
    					setCameraTarget(playerSource, playerSource)
    					fadeCamera(playerSource, true, 0.5)
    				end, 1000, 1, playerSource)
    			end
    		end
    	end
    end
    addEventHandler("onMarkerHit", enterMarker, Enter)

     

    A própria função setElementInterior, ja bota o player em um determinada posição. Tente assim:

    function Enter(playerSource)
    	if getElementType(playerSource) == "player" then
    		if getElementDimension(playerSource) == 0 and getElementInterior(playerSource) == 0 then
    			if not isPedInVehicle(playerSource) then
    				fadeCamera(playerSource, false, 0.5)
    				setElementInterior(playerSource, 0, 1040.612, -1015.891, -47.559+0.2)
    				setElementDimension(playerSource, 0)
    				setElementRotation(playerSource, 0, 0, 90)
    				setTimer(function(playerSource) 
    					setCameraTarget(playerSource, playerSource)
    					fadeCamera(playerSource, true, 0.5)
    				end, 1000, 1, playerSource)
    			end
    		end
    	end
    end
    addEventHandler("onMarkerHit", enterMarker, Enter)

     

  12. On 21/12/2020 at 11:46, mateplays said:

    Hey guys. I have a script where I want to draw text inside a "for" loop, and every row after the first one will vibrate. Have a look:

    spacer.png

    Here is the code for this tab (only this tab vibrates):

    
    dxDrawText("#ffffffBarátok", sx/2-825/2+300, sy/2-410/2,sx/2-825/2+530, sy/2-410/2 ,tocolor(69,182,254,255), 0.9, RobotoLSized, "center", "center", false, false, false, true)
    triggerServerEvent("loadFriends",localPlayer,localPlayer, getElementData(localPlayer, "acc:id"))
    counter = getElementData(localPlayer, "friendCount")
    if hasElementData(localPlayer, "friendCount") then
        if (getElementData(localPlayer, "friendCount") > scrollData and counter < maxShow) then
            for i=1, counter do
                friendOG = tostring(getElementData(localPlayer, "friends"..i))
                friendLegit = exports.rob_core:findPlayer(localPlayer, friendOG)
                dxDrawRectangle(sx/2-825/2,sy/2-515/2+(i*65), 825, 40, tocolor(0,0,0,220))
                if friendLegit then
                    dxDrawText(getPlayerName(friendLegit) .. " (ID: #45b6fe" .. getElementData(friendLegit, "playerid") .. "#ffffff)", sx/2-825/2+5+22,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true)
                else
                    if not (getElementData(localPlayer, "friendName"..i) == false) then
                        dxDrawText(tostring(getElementData(localPlayer, "friendName"..i)), sx/2-825/2+5+22,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true)
                    end
                end
    
                if tonumber(getElementData(localPlayer, "friendOnline"..i) == 1) then
                    isHeOnline = "igen"
                else
                    isHeOnline = "nem"
                end
    
                if not (getElementData(localPlayer, "friendOnline"..i) == false) then
                    dxDrawText("Online: #45b6fe"..tostring(isHeOnline), sx/2-825/2+5+41+120,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true)
                end
    
                if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then
                    dxDrawText("Legutóbb online: #45b6fe" .. tostring(getElementData(localPlayer, "friendLastLogin"..i)), sx/2-825/2+5+41+225,sy/2-515/2+(i*65)+2, 0, sy/2-515/2+(i*65)+2+36, tocolor(255,255,255,255), 1, Roboto, "left", "center",false,false,false,true)
                end
    
                if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then
                    if isInSlot(sx/2+330, sy/2-515/2+(i*65)+7, 65,25) then
                        dxDrawRectangle(sx/2+330, sy/2-515/2+(i*65)+7, 65,25, tocolor(215, 89, 89, 200))
                    else
                        dxDrawRectangle(sx/2+330, sy/2-515/2+(i*65)+7, 65,25, tocolor(215, 89, 89, 150))
                    end
                    dxDrawText("Törlés", sx/2+330, sy/2-515/2+(i*65)+7, sx/2+330+65, sy/2-515/2+(i*65)+7+25, tocolor(0,0,0,200), 1, Roboto, "center", "center")
                end
    
                if not (getElementData(localPlayer, "friendLastLogin"..i) == false) then
                    if isInSlot(sx/2+250, sy/2-515/2+(i*65)+7, 65,25) then
                        dxDrawRectangle(sx/2+250, sy/2-515/2+(i*65)+7, 65,25, tocolor(69,182,254, 200))
                    else
                        dxDrawRectangle(sx/2+250, sy/2-515/2+(i*65)+7, 65,25, tocolor(69,182,254, 150))
                    end
                    dxDrawText("Meghívás", sx/2+250, sy/2-515/2+(i*65)+7, sx/2+250+65, sy/2-515/2+(i*65)+7+25, tocolor(0,0,0,200), 1, Roboto, "center", "center")
                end
            end
        end
    end
    if isInSlot(sx/2-830/2, sy/2+470/2, 830,25) then
        dxDrawRectangle(sx/2-830/2, sy/2+470/2, 830,25, tocolor(69, 182, 254, 200))
    else
        dxDrawRectangle(sx/2-830/2, sy/2+470/2, 830,25, tocolor(69, 182, 254, 150))
    end
    dxDrawText("Új barát hozzáadása", sx/2+1/2, sy/2+500/2,sx/2+1/2, sy/2+500/2, tocolor(0,0,0,200), 1, Roboto, "center", "center")

    Please, if you can, help me.

    Take out your scroll method, and test it to see it.

  13. On 24/12/2020 at 11:09, Vilaum said:

    Olá eu queria pedir ajuda de um scripter para me ajudar fazer um script que dá dano so no headshot nao em outras partes do corpo quem conseguir fazer esse script manda abaixo por favor.

    English Version
     

    hello I wanted to ask for help from a scripter to help me make a script that only damage the headshot, not on other parts of the body.  

    Você usará o evento onPlayerDamage, para verificar quando o player é danificado, nela você pode verificar quais as partes do corpo foi atingida e trabalhar em cima dela.

    Então no caso, você deseja cancelar tiros que não seja na cabeça isso ?.

    Fará assim:

    blocked = {
    	{3}, -- torso
    	{4}, -- Ass
    	{5}, -- Left Arm
    	{6}, -- Right Arm
    	{7}, -- Left Leg
    	{8}, -- Right Leg
    }
    
    addEventHandler('onPlayerDamage', root, function(attacker, damage_causing, bodypart)
    	for i,v in ipairs(blocked) do
    		if bodypart == v[1] then -- caso bodypart seja igual qualquer um que está na tabela:
    			cancelEvent() -- o evento de dano será cancelado
    		end
    	end
    end)

     

    __________________________________________________________________________

    I ask someone with permission to move this topic to (Other Languages --> Portuguese / Português / Programação Em Lua) 

    • Like 1
×
×
  • Create New...