Jump to content

TeixeiraRB

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by TeixeiraRB

  1. 15 hours ago, DNL291 said:

    Você se refere ao dx-rectangle funcionando como o progress-bar da GUI? Use uma variável com o tamanho total da barra; digamos que você nomeia ela como barWidth.

    Você vai precisar fazer o seguinte calculo no 3º argumento de dxDrawRectangle, que é a largura:

    progressoAtual = (getHungerState() / 100) * barWidth

    Se você quer dizer o calculo da barra, isso é o principal, que é o calculo do progresso atual.

    Tipo fazer um resource de fome do 0 so que em dx.

     

    5 hours ago, Lord Henry said:

    Eu fiz um resource de fome/sede/sono que funciona assim. As barras aparecem em DX. O preço e tipo de alimento que é carregado depende do pickup (que também pode ser uma bebida). O sono é o mais simples, basta usar /dormir, dai o personagem faz animação de dormindo e começa a recarregar o sono aos poucos.

    Se quiserem, posso fazer um vídeo mostrando como funciona.

    Ficaria muito agradecido por ver o video 

  2. 3 hours ago, Lord Henry said:

    Então você está tentando editar recursos de terceiros, é isso?

    So estou colocando uma coisa que o dono do scripter devia ter colocada. Pois dominar a área em qualquer lugar é meio chato, por que a área pode se grande e sempre sera dominada. 

    27 minutes ago, DNL291 said:

    Você pode fazer isso, basta trocar. E editar uma tabela turfPos pra deixar apenas como coordenadas da marca. Para isso, você vai retornar algumas coisas como "onMarkerHit" no lugar do evento de colisão do colshape.

    A parte do MarkerHit até conseguindo, mas depois da parte do markerleave ai que veio o problema. Mas vou tenta observa bem e tenta mexer.

     

  3. Olá, gostaria de mudar esse sistema para que o jogador dominar a área através do marker e não pela colisão da área. Ai o marker ia fazer a função do ColCuboid esperou que tenha entendido ..

    ------------------------------------------------------
    --            Scripting By Sasu
    --		Copyright © 2013-2015 - All rights reserved.
    ------------------------------------------------------
    
    
    local turfPos = {
    { 2133.1950683594, 633.66455078125, 0, 197.5, 92, 90 },
    
    }
    
    local turfElement = {}
    local turfTimer = {}
    local checkComplete = false
    
    local messages = {
    	[1] = "Sistema de Territorio by:Sasuke * foi iniciado corretamente!",
    	[2] = "Esse território já pertence a %s",
    	[3] = "Você entrou em %s's do território. Aguarde 2 minutos para dominar!",
    	[4] = "Este território não pertence a ninguém. Aguarde 2 minutos para dominar!",
    	[5] = "Parabéns. Você consquistou o território!",
    	[6] = "Se você não voltar dentro de 20s, você não vai dominar o território",
    	[7] = "Você não conseguiu consquisou o território devido à ausência"
     }
     
    -- 	Nadie = None | Just a translation
    
    addEventHandler("onResourceStart", resourceRoot,
    function()
    	executeSQLQuery("CREATE TABLE IF NOT EXISTS Turf_System ( Turfs TEXT, GangOwner TEXT, r INT, g INT, b INT)")
    	--
    	local check = executeSQLQuery("SELECT * FROM Turf_System" )
    	if #check == 0 then
    		for i=1,#turfPos do
    			executeSQLQuery("INSERT INTO Turf_System(Turfs,GangOwner,r,g,b) VALUES(?,?,?,?,?)", "Turf["..tostring(i).."]", "Nadie", 0, 255, 0)
    		end
    	elseif #check > 1 then
    		for i = #check, #turfPos do
    			executeSQLQuery("INSERT INTO Turf_System(Turfs,GangOwner,r,g,b) VALUES(?,?,?,?,?)", "Turf["..tostring(i).."]", "Nadie", 0, 255, 0)
    		end
    	end
    	
    	for i,v in ipairs(turfPos) do
    		local sqlData = executeSQLQuery("SELECT * FROM Turf_System WHERE Turfs=?", "Turf["..tostring(i).."]")
    		local turfCol = createColCuboid(unpack(v))
    		setElementData(turfCol, "getTurfGang", sqlData[1].GangOwner)
    		local turfArea = createRadarArea(v[1], v[2], v[4], v[5], sqlData[1].r, sqlData[1].g, sqlData[1].b, 175)
    		turfElement[turfCol] = {turfCol, turfArea, i}
    		turfTimer[turfCol] = {}
    	end
    	
    	outputDebugString( messages[1] )
    end )
    
    addEventHandler ( "onColShapeHit", root,
    	function ( player )
    		if turfElement[source] and source == turfElement[source][1] then
    			local turf,area,id = unpack( turfElement[source] )
    			local playerGang = getElementData ( player, "gang" )
    			local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(id).."]" )
    			if ( turfGang[1].GangOwner == playerGang ) then
    				outputChatBox( messages[2]:format( turfGang[1].GangOwner or "None" ), player, 0, 255, 0, false )
    			else
    				local playerGang = getElementData ( player, "gang" )
    				setElementData( source, "warTurf", playerGang )
    				if ( isTimer ( turfTimer[source][1] ) ) then
    					if isTimer( turfTimer[source][2] ) then killTimer( turfTimer[source][2] ) end 
    					return 
    				end
    				if ( playerGang ) then
    					local r, g, b = unpack ( getGangColor ( playerGang ) )
    					-- local r, g, b = 255, 255, 255
    					setRadarAreaFlashing ( area, true )
    					if turfGang[1].GangOwner ~= "Nadie" then
    						outputChatBox( messages[3]:format( turfGang[1].GangOwner ), player, 0, 255, 0, false )
    					else
    						outputChatBox( messages[4], player, 0, 255, 0, false )
    					end
    					
    					turfTimer[source][1] = setTimer (
    						function ( )
    							local players = getGangPlayersInTurf ( turf, playerGang )
    							setRadarAreaColor ( area, tonumber(r), tonumber(g), tonumber(b), 175 )
    							for _, player in ipairs ( players ) do
    								outputChatBox( messages[5], player, 0, 255, 0, false )
    								triggerClientEvent(player, "onTakeTurf", player)
    								givePlayerMoney ( player, 4000 )
    								executeSQLQuery("UPDATE Turf_System SET GangOwner=?,r=?,g=?,b=? WHERE Turfs=?", playerGang, tonumber(r), tonumber(g), tonumber(b), "Turf["..tostring(id).."]" )
    								-- setElementData ( turf, "getTurfGang", playerGang )
    							end
    							setRadarAreaFlashing ( area, false )
    						end
    					,120000, 1)
    				end
    			end
    		end
    	end
    )
    
    addEventHandler ( "onColShapeLeave", root, 
    	function( player )
    		if turfElement[source] and source == turfElement[source][1] then
    			if isTimer( turfTimer[source][1] ) then
    				local aGang = getElementData( source, "warTurf" )
    				local ps = getGangPlayersInTurf( source, aGang )
    				if #ps == 0 then
    					outputChatBox( messages[6], player, 255, 0, 0 )
    					turfTimer[source][2] = setTimer(
    						function(source, aGang)
    							if isTimer(turfTimer[source][1]) then killTimer(turfTimer[source][1]) end
    							setRadarAreaFlashing(turfElement[source][2], false)
    							for _, v in ipairs( getElementsByType("player") ) do
    								if getElementData(v, "gang") == aGang then
    									outputChatBox(messages[7], v, 255, 0, 0)
    								end
    							end
    						end
    					, 20000, 1, source, aGang)
    				end
    			end
    		end
    	end
    )
    
    function getGangPlayersInTurf( turf, gang ) -- element, string
    	if turf and gang then
    		local players = getElementsWithinColShape ( turf, "player" )
    		local gPla = {}
    		for _, v in ipairs(	players ) do		
    			if getElementData(v, "gang") == gang then
    				table.insert(gPla, v)
    			end
    		end
    		return gPla
    	end
    end
    
    function getGangColor(gangName)
    	return exports[ "gang_system" ]:getGangData ( gangName, "color" )
    end

     

  4. Ta dando erro Lord Henry  Erro: Markers.lua:18: Bad argument @ 'getPedOccuipedVehicle' [Expected ped at argument 1, got string 'Quit' ]

     

    Spawna = createMarker (-314.8583984375, 1546.0322265625, 75.5625 -1, "cylinder", 2, 255 ,0 ,0, 255)
    
    veh = {}
    function Pegar(thePlayer)
    if isElementWithinMarker(thePlayer, Spawna) then
    if hilux and isElement( hilux ) then destroyElement ( hilux )
    hilux = nil
    end
    x,y,z = getElementPosition(thePlayer)
    Islamico = true
    hilux = createVehicle(422,-282.26953125, 1529.451171875, 75.359375, 0, 0, 61.878692626953)
    warpPedIntoVehicle( thePlayer, hilux )
    end
    end
    addEventHandler( "onMarkerHit", Spawna, Pegar )
    
    function sair(thePlayer)
        local hilux = getPedOccupiedVehicle(thePlayer)
        if hilux then
            destroyElement ( hilux )
        end
    end
    addEventHandler ("onPlayerQuit", getRootElement(), sair)

     

  5. Tudo bem? Queria saber como faço para quando o player sair do servidor destruir o veiculo q foi criado quando ele passo pelo marker. Exemplo to fazendo um script de trabalho ai quero q quando o player passa pelo marker vai spawna o veiculo certo? isso eu ja sei fazer mas exemplo a net dele cair so que o veiculo vai fica do servidor ainda entao queria q quando ele sair do sv ia destruir.

  6. Tudo bem com vocês? Bem vou direto ao assunto gostaria de sabe como faço para adiciona o Player do tal TIME q criei. Exemplo quando eu aperta do button vai adicionar ele do Time lenhador ai quando ele desloga vai tira ele do Time. Bom obrigado a quem me ajuda 

    function Lenhador ()
        LenhadorTeam = createTeam ( "Lenhador", 0, 255, 0 )
    end
    addEventHandler("onResourceStart", resourceRoot, Lenhador)

     

×
×
  • Create New...