Jump to content

MesaDowN

Members
  • Posts

    111
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by MesaDowN

  1. dxDrawRectangle, onClientRender, bindKey(eu prefiro armazenar a bind no client), triggerServerEvent(Chamar o evento no lado client) , (addEvent e addEventHandler (adicionar um evento para ser "triggado" no client side)).

  2. if Selecionado == "Agua" then
    					    if Agua_01 > 0 then
    						    local Sede_Atual = getElementData ( localPlayer, "AirNewSCR_Sede" ) or 0
    					        if Sede_Atual == 100 then
    								exports.tenorio_info:showBoxS(localPlayer, " Você não está com Sede!", "error")
    						    else
    					            setElementData ( localPlayer, "AirNewSCR_Sede", Sede_Atual + 15 )
    								setElementData ( localPlayer, "AirNewSCR_Inventario_Agua", Agua_01 - 1 )
    						    end
    						else
    							exports.tenorio_info:showBoxS(localPlayer, " Você não Possui Agua no Inventario!", "error")
    						end

    Tente assim

  3.                                             SARP2.png

    :infinitoazul~1: Um servidor organizado e brasileiro, sobre RP de economia Americana. :infinitoazul~1:  

    Nosso servidor foi criado com o intuito de divertir e agradar a todos, temos tudo que um bom RP precisa para funcionar. Temos sistemas simples de entender, e fáceis de usar. Você precisa apenas criar o seu personagem para começar a jogar. Não é dificil, é divertido! . Caso não entenda algo, é só falar com algum Fundador . Em breve teremos sistemas únicos, bots únicos e um site.

    separador_1.gif?width=500&height=1
     O San Andreas RP tem como finalidade o entretenimento sem fins lucrativos, com a encenação do mundo real e não há nenhuma ligação com os órgãos públicos e marcas aqui citados. Caso esteja interessado e queira jogar em nosso servidor, leia os termos de uso . Caso concorde com os termos, basta ler as regras do servidor para evitar problemas. Boa diversão !
    separador_1.gif?width=500&height=1
    :infinitorosa: San Andreas RP ©️ 2020  - Todos os Direitos Reservados.



    Discord >> discord.gg/Wj4gTtn

     

     

  4. 2 minutes ago, murilo2929 said:

    E um sistema de customizar o veiculo, mas quando entro no marker algumas partes do menu não aparecem e esse erro ocorre.
    66YeEpf.png

    
    function formatNumber(amount, spacer)
    	if not spacer then
    		spacer = ","
    	end
    
    	amount = math.floor(amount) ---aqui esta apontando o erro
    
    	local left, num, right = string.match(tostring(amount), "^([^%d]*%d)(%d*)(.-)$")
    	return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. spacer):reverse()) .. right
    end
    

     

    Poste o código por completo.

  5. 14 hours ago, Developer. said:

     

    
    local posX, posY, posW, posH = 500, 500, 200, 200
    local painel = true
    function teste(button,state)
       if painel == true then
          if state == "down" then
             if isCursorOnElement(posX, posY, posW, posH ) then
                  outPutChatBox("Teste Dx bem-sucedido")
             end
          end
       end
    end
    addEventHandler ("onClientClick", root, teste)
    
    
    -- função util
    function isCursorOnElement(x,y,w,h)
       local mx,my = getCursorPosition ()
       local fullx,fully = guiGetScreenSize()
       cursorx,cursory = mx*fullx,my*fully
       if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
          return true
       else
          return false
       end
    end
    

     

    Apenas uma duvida developer, o que significa o comando state? Serve para verificar que o click está sendo executado?

  6. Bom dia, vim aqui esclarecer uma coisa.

    Estou fazendo o emprego de carregador, e o mesmo precisa de 5 caixas entregues para puder pegar o camião e sair.

    1º- Quero que ao chegar no marker "Marker_Entregar[source]" , ele adicione +1 elementData.

    2º Quero que quando o veículo saia dali, ele faça uma vericação se não tem nada naquele local e spawne outro veículo na mesma posição.

    veh_pc = {}
    
    local markercarregar = createMarker(2795.09546, -2425.29395, 13.63188-1.1, "cylinder", 2, 30,144,255)
    
    ocupado = { -- x, y, z, ocupado
        [1] = {2787.782, -2424.239, 13.634, 0, 0, 180, false, 2787.803, -2420.378, 13.634}, -- Esta coordenada está no seu script.
        [2] = {2788.123, -2410.558, 13.634, 0, 0, 0, false, 2788.146, -2414.291, 13.634}, -- Esta coordenada eu inventei.
        [3] = {2750, -2431.782, 13.643, 0, 0, 270, false, 2746.177, -2431.841, 13.643},
        [4] = {2750, -2441.882, 13.643, 0, 0, 270, false, 2746.153, -2441.895, 13.643},
        [5] = {2750, -2448.111, 13.643, 0, 0, 270, false, 2746.181, -2448.31, 13.648},
    }
    
    
    function showMarker()
    local Emprego = getElementData(source, "Emprego")
    	if Emprego == "Carregador" then
    		for i, vaga in ipairs (ocupado) do	
           		local x, y, z, r, g, b, status, a, c, d = unpack(vaga)
    			marcacao = createMarker( a, c, 12, "cylinder", 1.5, 30,144,255, 180 )
    			attachElements ( marcacao, veh_pc[source], 0, -4, -1 ) 
    			outputDebugString("02")
    end
    end
    end
    addEvent( "ShowMarkers", true)
    addEventHandler( "ShowMarkers", getRootElement(), showMarker)
    
    function createVeh(thePlayer)
    	local Emprego = getElementData(source, "Emprego")
    	for i, vaga in ipairs (ocupado) do	
           	local x, y, z, r, g, b, status, a, c, d = unpack(vaga)
    		veh_pc[source] = createVehicle ( 414, x, y, z, r, g, b)	
    		setVehicleLocked( veh_pc[source], true)
    		outputDebugString("01")
    		end
        end
    addEventHandler( "onResourceStart", getRootElement(), createVeh )
    
    
    
    
    function tempo(thePlayer)
    	if getElementData(thePlayer, "veiculoalreadyspawnado") == true then
    		setTimer(function()
    			setElementData(source, "veiculoalreadyspawnado", false) 
    		end, 3000, 1)
    	end
    end
    
    function setartempo(source)
    			setElementData(source, "veiculoalreadyspawnado", false) 
    end
    addCommandHandler("fodasse", setartempo)
    
    --------------------------------------------
    --JOB--
    
    
    Object_Caixa = {}
    Marker_Entregar = {}
    Blip_Entregar = {}
    
    
    local Blip_Emprego = createBlipAttachedTo( markercarregar, 16 )
    setBlipVisibleDistance(markercarregar, 150)
    
    function Mesa_Caixa (source) 			
    	local Emprego = getElementData ( source, "Emprego" )
    	local Px, Py, Pz = getElementPosition( markercarregar )
    	local Caixa = getElementData( source, "Caixa" )  
    		if isElementWithinMarker(source, markercarregar) then
    			if Caixa == false then 		
    				if Emprego == "Carregador" then
    					setPedAnimation( source, "CARRY", "liftup", 1.0, false )
    					setTimer(function()
    						if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
    						if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
    						if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
    						setElementData(source, "Recompensa", 0)
    						setPedAnimation( source, nil )
    						setElementData( source, "Caixa", true )
    						toggleControl( source, "jump", false )
    						toggleControl( source, "fire", false )
    						toggleControl(source, "aim_weapon", false)
    						setPedAnimation( source, "CARRY", "crry_prtial", 4.1, true, true, true )
    						Object_Caixa[source] = createObject( 1271, Px, Py, Pz )
    						Marker_Entregar[source] = createMarker (2787.84521, -2420.40527, 13.63365-1.1, "cylinder", 2.5, 16, 111, 231, 50)	
    						Blip_Entregar[source] = createBlipAttachedTo( Marker_Entregar[source], 0 )				
    						setElementVisibleTo ( Marker_Entregar[source], root, false )
    						setElementVisibleTo ( Blip_Entregar[source], root, false )
    						setElementVisibleTo ( Marker_Entregar[source], source, true )
    						setElementVisibleTo ( Blip_Entregar[source], source, true )
    						exports.bone_attach:attachElementToBone(Object_Caixa[source], source, 4, 0, 0.4, - 0.6, -90, 0, 0 )
    					end, 1000, 1)
    				end
    			end
    		end
    	end
    addCommandHandler("caixa", Mesa_Caixa)
    
    function Fim_Emprego (source) 
    	local Caixa = getElementData( source, "Caixa" )	
    	local pay = math.random(100,200)
    	local Recompensa = math.random(1, 35)
    	if not isPedInVehicle ( source ) then 
    		if isElementWithinMarker(source, Marker_Entregar[source]) then
    			if Caixa == true then    
    				setPedAnimation( source, "CARRY", "putdwn", 1.0, false, false, false, true )  
    				setTimer(function()
    					if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
    					if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
    					if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
    					setElementData( source, "Caixa", false )	
    					toggleControl( source, "jump", true )
    					toggleControl( source, "fire", true )
    					toggleControl(source, "aim_weapon", true)
    					setPedAnimation( source, "CARRY", "liftup", 0.0, false, false, false, false)
                		setElementData(source,"char:money", getElementData(source,"char:money") + pay)
                		setElementData(source,"Entregues", tonumber(getElementData(source,"Entregues") + 1))
    					exports.Scripts_Dxmessages:outputDx ( source, "Você entregou a caixa e ganhou: "..getElementData(source, "Recompensa").."$", "success" )
    				end, 1200, 1) 
    			end
    		end
    	end
    end	
    addCommandHandler( "entregar", Fim_Emprego)
    
    
    fds = createMarker (2796.03687, -2420.05981, 13.63165-1.1, "cylinder", 2.5, 16, 111, 231, 50)
    
    function setardata(source)
    	if getElementData( source, "Caixa" ) == true then
    		setElementData( source, "Caixa", false )	
    	end
    end
    addCommandHandler("a", setardata)
    
    function aaaa(source)
    	cona = tonumber(getElementData(source, "Entregues"))
       	if cona >= 1 then
       		outputDebugString(""..cona.."")
       	end
    end
    addEventHandler( "onMarkerHit", fds, aaaa )
    
    
    addEventHandler( "onPlayerQuit", root,
      function()
    	if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
    	if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
    	if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
      end)
      
    addEventHandler( "onPlayerWasted", root,
      function()
    	if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
    	if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
    	if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
    	setElementData( source, "Caixa", false )	
    	toggleControl( source, "jump", true )
    	toggleControl( source, "fire", true )
    	toggleControl(source, "aim_weapon", true)
      end)
    

     

  7. 9 hours ago, Deniel said:
    
    local aberto = false
    local phone = {}
    local animTimer = {}
    
    function abrircelular ()
       if aberto == false then
          aberto = true
          setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) --/> Puxar Celular
          setPedAnimationProgress(player, "phone_in", 0.8)	  
          setPedWeaponSlot(localPlayer, 0)
          phone[localPlayer] = createObject(330, 0, 0, 0, 0, 0, 0)
          exports.bone_attach:attachElementToBone(phone[localPlayer], localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15)
          setElementDimension(phone[localPlayer], getElementDimension(localPlayer))
          setElementInterior(phone[localPlayer], getElementInterior(localPlayer))
    	  
          animTimer[localPlayer] = setTimer(function(player)
    	      if ( isElement(player) ) then
    			setPedAnimationProgress(player, "phone_in", 0.8)
    		end
    	  end, 500, 0, localPlayer)
       elseif aberto == true then
          setPedAnimation (localPlayer, "ped", "phone_out", 50, false, false, false, false) --/> Guardar Celular
    	  aberto = false
       end
    end
    bindKey ( "F1", "down", abrircelular) 
    addCommandHandler ( "celular", abrircelular)
    
    addEvent("remover_celular", true)
    addEventHandler("remover_celular", root, function()
    	removePhone(localPlayer)
    	setPedAnimation (localPlayer, "ped", "phone_out", 50, false, false, false, false)
    end)
    

    Bom, praticamente essa é uma animação que estou montando onde o player abre o celular e fica olhando pra ele, porém tem 2 coisas que estou apanhando.
    1. A animação por algum motivo esta bugando, quando eu abro o celular pela segunda vez a animação fica ''flicando'' como se ele estivesse tentando fechar o celular e abrir ao mesmo tempo.
    2. Não sei por que mais o addEvent também não está indo. Que praticamente as ultimas 4 linhas eu tinha uma intenção de quando ele ''guardar'' o celular com a animação ''phone_out'', o event remover o celular da mão dele.

    Poste o /debugscript 3

  8. <meta>
         <info author="Amanda" type="animation" name="choro" description="Script de chorar" />
         <script src="script.Lua"  type="server"/>
    </meta>
    
    function toggleSit(thePlayer)
        if not getElementData(thePlayer, "sitting") then
            setPedAnimation(thePlayer, "ped", "seat_down", -1, false, false, false, false)
            setElementData(thePlayer, "sitting", true)
        else
            -- If you use again this command then your character stand up
            setPedAnimation(thePlayer)
            removeElementData(thePlayer, "sitting")
        end
    end
    addCommandHandler("sit", toggleSit)

    Tenta ai agora...

    • Thanks 1
  9. Use a Função de code na proxima que for postar seu código "<>", e poste ele por completo.

    function pegarm4(player)
        if isElementWithinMarker(player, markerWeapon) then
        	guiEdit()
            if getPlayerMoney(player) >= 12000 then
                takePlayerMoney(player, 12000) --Remover Dinheiro
                giveWeapon(player, 31, 300, true) --Pegar Arma
                outputChatBox("#ffffffVocê comprou uma M4 com 300 munições.", player, 255,255,255,true)
            else 
                outputChatBox("#ff0000Você não tem dinheiro suficiente para comprar.", player, 255,255,255,true)
            end
        end
    end
    addCommandHandler("m4", pegarm4)
    
    
    function guiEdit()
     GUIEditor.window[1] = guiCreateWindow(0.32, 0.26, 0.41, 0.46, "LOJA DE ARMAS", true)
     guiWindowSetSizable(GUIEditor.window[1], false)
     GUIEditor.button[1] = guiCreateButton(0.37, 0.12, 0.22, 0.11, "M4 = 12000R$", true, GUIEditor.window[1])
     guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF25FC02")
     GUIEditor.button[2] = guiCreateButton(0.38, 0.26, 0.21, 0.11, "Deagle = 7000R$", true, GUIEditor.window[1])
     guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF25FC02")
     GUIEditor.button[3] = guiCreateButton(0.38, 0.40, 0.20, 0.10, "Ak-47 = 15000R$", true, GUIEditor.window[1])
     guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF25FC02")
     GUIEditor.button[4] = guiCreateButton(0.38, 0.53, 0.20, 0.10, "MP5 = 30000", true, GUIEditor.window[1])
     guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF25FC02")    
    end

    É isso?

×
×
  • Create New...