Jump to content

Bullyn

Members
  • Posts

    48
  • Joined

  • Last visited

Posts posted by Bullyn

  1. On 06/02/2022 at 05:35, Andrew Moura said:

    Eu estou fazendo um script e preciso checar se o player já passou por um tal marker, caso ele tenha passado gostaria de mandar uma mensagem para o player, mas como eu fiz o script no server-side a variável vai para todos os jogadores, eu vi que posso resolver isso colocando a variável como uma tabela mas não estou conseguindo verificar se o player já passou por lá ou não, alguém poderia me ajudar?

    Você pode utilizar o setElementVisibleTo.

  2. On 11/02/2022 at 13:25, ZDN said:

    Queria saber se tem como alguem me ajudar, tenho um arquivo que ta faltando um script para verificar se tem o item (maconha3) no inventario para efetuar a venda no ilegal.

    -----------------------------------------------------------------------------------------------------------------------------------------
    assaltada = {}
    markers = {}
    tempoBind = {}
    -----------------------------------------------------------------------------------------------------------------------------------------
    function onHit(playerSource)
    	if not isPedInVehicle(playerSource) then
                    if getPedWeapon(playerSource) == 0 or getPedWeapon(playerSource) == 0 or getPedWeapon(playerSource) == 0 then
    			for i, v in pairs(markers) do
    				if v == source then
    					if not assaltada[i] then
    						if not isTimer(tempoBind[playerSource]) then
    							exports._infobox:addNotification(playerSource, "Pressione 'K' para vender as drogas.", "info")
    							bindKey(playerSource, "k", "down", startAssalto)
    							tempoBind[playerSource] = setTimer(unbindKey, 10000, 1, playerSource, "k", "down", startAssalto)
    						end
    					end
    				end
    			end
    		end
    	end
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    function startAssalto(playerSource)
    	if not isPedInVehicle(playerSource) then
                    if getPedWeapon(playerSource) == 0 or getPedWeapon(playerSource) == 0 or getPedWeapon(playerSource) == 0 then
    			for i, v in pairs(markers) do
    				if isElementWithinMarker(playerSource, v) then
    					local count = 0
    					for _, players in pairs(getElementsByType("player")) do
    						if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_Policial)) then
    							count = count + 1
    						end
    					end
    					if count >= minPolices then
    						setElementAlpha(v, 0)
    						if isTimer(tempoBind[playerSource]) then
    							killTimer(tempoBind[playerSource])
    							tempoBind[playerSource] = nil
    						end
    						unbindKey(playerSource, "k", "down", startAssalto)
    						assaltada[i] = true
    						local x, y, z = positions[i][1], positions[i][2], positions[i][3]
    						setElementPosition(playerSource, x, y, z)
    						setElementRotation(playerSource, 0, 0, positions[i][4])
    						setElementFrozen(playerSource, true)
    						toggleAllControls(playerSource, false, true, false)
    						setPedAnimation(playerSource, "INT_SHOP", "shop_cashier", positions[i][6], true, false, false, false, 0, false)
    						triggerClientEvent(playerSource, "progressBar", playerSource, positions[i][6])
    						for _, players in pairs(getElementsByType("player")) do
    							if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(players)), aclGetGroup(ACL_Policial)) then
    								exports._infobox:addNotification(players, "[COPOM]: Suspeita de venda de drogas na cracolandia "..positions[i][5], "warning")
    							end
    						end
    						setTimer(function()
    							setElementFrozen(playerSource, false)
    							toggleAllControls(playerSource, true)
    							local money = math.random(positions[i][7], positions[i][8])
                                                            exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("take", playerSource, "maconha3", 1)
    							exports["[MOD]Inventario"]:GiveAndTakeAndGetItem("give", playerSource, "dinheirosujo", money)
    							exports._infobox:addNotification(playerSource, "Você recebeu "..money.." Dinheiro Sujo", "money")
    							local wanted = getPlayerWantedLevel(playerSource)
    							if wanted <= 3 then
    								setPlayerWantedLevel(playerSource, wanted + 3)
    							else
    								setPlayerWantedLevel(playerSource, 6)
    							end
    							local name = getPlayerName(playerSource)
    							local id = getElementData(playerSource, "ID") or "N/A"
    							exports["[Scripts]Logs"]:CreateLog("[LOJINHA]\nAssaltante: "..name.." ["..id.."]\nMercadinho: "..positions[i][5].."\nValor roubado: $"..money)
    						end, positions[i][6], 1)
    						setTimer(function()
    							setElementAlpha(v, 35)
    							assaltada[i] = false
    						end, respawnTime, 1)
    					else
    						exports._infobox:addNotification(playerSource, "É preciso ter pelo menos "..minPolices.." policiais na cidade para realizar o assaltos", "error")
    					end
    				end
    			end
    		else
    			exports._infobox:addNotification(playerSource, "Você precisa estar com maconha na mochila para vender", "error")
    		end
    	else
    		exports._infobox:addNotification(playerSource, "Você não vender dentro de um veículo", "error")
    	end
    end
    -----------------------------------------------------------------------------------------------------------------------------------------
    for i, v in pairs(positions) do
    	markers[i] = createMarker(positions[i][1], positions[i][2], positions[i][3] -1, "cylinder", 1.2, 255, 255, 255, 0)
    	addEventHandler("onMarkerHit", markers[i], onHit)
    end
    -----------------------------------------------------------------------------------------------------------------------------------------

     

    Qual o exports do seu inventário?

  3. 21 hours ago, Goularte said:

    Você precisa de mais coisas aí pra poder chegar num resultado satisfatório. Você precisa alterar o código responsável pelo drop ou transferência do item implementando uma verificação, e com isso a remoção da arma caso não tenha mais, etc. Tem uma solução mais simples com timer, que eu não recomendo.

    Como seria com o timer?

  4. Bom, seguinte.

    Eu possuo um código em que a arma fica no corpo do personagem quando não está nas mãos dele, mas, quando o player não possui mais a arma ela continua em seu corpo.

    Eu queria verificar se o player possui a arma em seu inventário, e se ele não possuir, eu quero remover o objeto do seu corpo.
    Aqui está o exports de verificar o item do inventário.

    exports["Inventario"]:GiveAndTakeAndGetItem("get", player, "m4a1", "1")


    Abaixo está a função " útil " para destruir o objeto do player.

    Client-side.

    function destruirArma(jug,slot)
    	destroyElement(jugadores[jug][slot])
    	jugadores[jug][slot] = nil
    end


    Eu queria saber, como eu posso verificar se o player possui a arma em seu inventário, se caso ele não possua, eu quero remover a arma do seu corpo.

     

  5. Eu preciso de uma ajuda, eu queria saber, como eu posso verificar nestá função abaixo, se o player está na Acl de " Staff ". Ao invés de " account:staff "

    OBS: ( Está na parte do cliente. )

     

    button = function()
    	if visible == false then
    		visible = true 
    		addEventHandler("onClientRender",root,render)
    		for i ,v in ipairs(getElementsByType("player")) do
    			local name = getPlayerName(v)
    			local staff = v:getData("account:staff")
    			local avatar = v:getData("account:avatar") or 0
    			local ID = v:getData("ID") or 'N/A'
    			if staff then 
    				table.insert(players,{name = name, staff = staff , ID = ID , avatars = avatar})
    			end
    		end
    		for i ,v in ipairs(getElementsByType("player")) do
    			local name = getPlayerName(v)
    			local staff = v:getData("account:staff")
    			local ID = v:getData("ID") or 'N/A'
    			local avatar = v:getData("account:avatar") or 0
    			if not staff then 
    				table.insert(players,{name = name, staff = staff , ID = ID , avatars = avatar})
    			end
    		end
    	else 
    		visible = false
    		removeEventHandler("onClientRender",root,render)
    		players = {}
    	end
    end
    bindKey ("TAB","both",button)

     

  6. Eu tenho um script de chat diferente do chat padrão do Gta
    unknown.png

     

    A menssagem deveria ser para o chat local, mas ela aparece para todos no chat!
     

    Código na partde de lua:
     

    
    Chatbox = { };
    
    cLocal = { };
    cTwitter = { };
    cOlx = { };
    cAnonymous = { };
    
    addEventHandler( "onClientResourceStart", resourceRoot,
    	function( )
    
    		local showC = showChat( false )
    
    		if showC == true then
    
    			showChat( false )
    			addEventHandler( "onClientRender", root, chatbox )
    
    		end
    
    		Animationtick = getTickCount( )
    		pagechat = 'local'
    		selectchat = pagechat
    
    		digit = guiCreateEdit( chatPosition[ 1 ], chatPosition[ 2 ] + 28 * 10, 344, 30, "dsadasd", false )
    		guiSetAlpha( digit, 0 )
    		guiSetVisible( digit, false )
    		guiEditSetMaxLength( digit, 50 )
    
    	end
    )
    
    function cancel( button )
    	if showdigit then
    		if button == "p" or "F1" or "F2" or "F3" or "F4" or "F5" or "F6" or "F7" or "F8" or "F9" or "F10" or "F11" or "b" or "enter" then
    			cancelEvent()
    		end
    	end
    end
    addEventHandler("onClientKey", getRootElement(), cancel)
    
    
    function chatbox( )
    
    	dxDrawRectangle( chatPosition[ 1 ], chatPosition[ 2 ], 344, 36, tocolor( 41, 41, 41, 255 ), false )
    
    	if showdigit then
    
    		if isElement( digit ) then
    
    			dxDrawTextDigit( guiGetText( digit ), chatPosition[ 1 ], chatPosition[ 2 ] + 28 * 10, 344, 26, tocolor( 0, 0, 0, 120 ), "default-bold" )
    
    		end
    
    	end
    
    	for i, v in ipairs( chat ) do
    
    		if export:cursorOnElement( chatPosition[ 1 ] + i * 86 - 86, chatPosition[ 2 ], 86, 36 ) or selectchat == v then
    
    			dxDrawRectangle( chatPosition[ 1 ] + i * 86 - 86, chatPosition[ 2 ], 86, 36, tocolor( 0, 0, 0, 50 ), false )
    			dxDrawRectangle( chatPosition[ 1 ] + i * 86 - 86, chatPosition[ 2 ] + 6 * 6 - 2, 86, 2, tocolor( 0,255,127, 255 ), false )
    
    		end
    
    		dxDrawImage( chatPosition[ 1 ] + i * 86 - 86, chatPosition[ 2 ], 86, 36, "assets/icons/"..v..".png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), false )
    
    	end
    
    	if pagechat == 'local' then
    
    		for iloc, loc in ipairs( cLocal ) do
    
    			if iloc > 12 then
    
    				table.remove( cLocal, 1 )
    
    			end
    
    			if loc.visible then
    
    				loc.alpha = loc.alpha + 10
    
    				if loc.alpha > 255 then
    
    					loc.alpha = 255
    
    				end
    
    			end
    
    			dxDrawTextCenter( loc.message, chatPosition[ 1 ], chatPosition[ 2 ] + iloc * 20 + 20, 344, 20, { 247, 178, 94, loc.alpha }, { 255, 255, 255, loc.alpha }, "default-bold" )
    
    		end
    
    	elseif pagechat == 'twitter' then
    
    		for itw, twi in ipairs( cTwitter ) do
    
    			if twi.visible then
    
    				twi.alpha = twi.alpha + 10
    
    				if twi.alpha > 255 then
    
    					twi.alpha = 255
    
    				end
    
    			end
    
    			if itw > 12 then
    
    				table.remove( cTwitter, 1 )
    
    			end
    
    			dxDrawTextCenter( twi.message, chatPosition[ 1 ], chatPosition[ 2 ] + itw * 20 + 20, 344, 20, { 93, 155, 226, twi.alpha }, { 255, 255, 255, twi.alpha }, "default-bold" )
    
    		end
    
    	elseif pagechat == 'olx' then
    
    		for iol, vol in ipairs( cOlx ) do
    
    			if vol.visible then
    
    				vol.alpha = vol.alpha + 10
    
    				if vol.alpha > 255 then
    
    					vol.alpha = 255
    
    				end
    
    			end
    
    			if iol > 12 then
    
    				table.remove( cOlx, 1 )
    
    			end
    
    			dxDrawTextCenter( vol.message, chatPosition[ 1 ], chatPosition[ 2 ] + iol * 20 + 20, 344, 20, { 171, 245, 98, vol.alpha }, { 255, 255, 255, vol.alpha }, "default-bold" )
    
    		end
    
    	elseif pagechat == 'anonymous' then
    
    		for iav, van in ipairs( cAnonymous ) do
    
    			if van.visible then
    
    				van.alpha = van.alpha + 10
    
    				if van.alpha > 255 then
    
    					van.alpha = 255
    
    				end
    
    			end
    
    			if iav > 12 then
    
    				table.remove( cAnonymous, 1 )
    
    			end
    
    			dxDrawTextCenter( van.message, chatPosition[ 1 ], chatPosition[ 2 ] + iav * 20 + 20, 344, 20, { 255, 60, 60, van.alpha }, { 255, 255, 255, van.alpha }, "default-bold" )
    
    		end
    
    	end
    
    end
    
    addEventHandler( "onClientClick", root,
    	function( button, state )
    
    		if ( button == "left" and state == "down" ) then
    
    			for i, v in ipairs( chat ) do
    
    				if export:cursorOnElement( chatPosition[ 1 ] + i * 86 - 86, chatPosition[ 2 ], 86, 36 ) then
    
    					selectchat = v
    					pagechat = selectchat
    
    				end
    
    			end
    
    		end
    
    	end
    )
    
    addEventHandler( "onClientKey", root,
    	function( key, press )
    
    		if key == "t" then
    
    			if showdigit == false then
    
    				showdigit = true
    				guiSetVisible( digit, true )
    				guiFocus( digit )
    				setTimer( function( ) guiSetText( digit, "" ) end, 4, 1 )
    				showCursor( true )
    
    			end
    
    		elseif key == "enter" then
    
    			if pagechat then
    
    				if showdigit == true then
    
    					local text = guiGetText(digit)
    					if text ~= "" then
    						if (string.sub(text,1,1) == "/") then
    							text = text:sub(2, #text)
    
    							if (text:gsub("%s", "") == "")then
    								return
    							end
    
    							local command = text:split(" ")
    							local args = ""	
    							for i=2, #command do
    								args = args.." "..command[i]
    							end
    
    							executeCommandHandler(command[1], args)
    							triggerServerEvent("executePlayerCommand", resourceRoot, command[1], args)
    						else
    							while (text:find("@@@@@@@@@@")) do
    								text = msg:gsub("@@@@@@@@@@", "@@@")
    							end
    
    							triggerServerEvent( "getChatMessage", resourceRoot, guiGetText( digit ), pagechat )
    
    						end
    
    					end
    
    					showdigit = false
    					guiSetVisible( digit, false )
    					showCursor( false )
    
    				end
    
    			end
    
    		end
    
    	end
    )
    
    function setChatMessage( message, page )
    
    	if message and page then
    
    		local self = setmetatable( { 
    
    			message = message,
    			pagechat = page,
    			color = { },
    			alpha = 0,
    			visible = true,
    
    		}, Chatbox )
    
    		if self then
    
    			if self.pagechat == 'local'then
    
    				table.insert( cLocal, self )
    
    			elseif self.pagechat == 'twitter' then
    
    				table.insert( cTwitter, self )
    
    			elseif self.pagechat == 'olx' then
    
    				table.insert( cOlx, self )
    
    			elseif self.pagechat == 'anonymous' then
    
    				table.insert( cAnonymous, self )
    
    			end
    
    		end
    
    	end
    
    	return self;
    end
    addEvent( "setChatMessage", true )
    addEventHandler( "setChatMessage", resourceRoot, setChatMessage )

     

     

    A parte do server que eu tentei fazer!!!!

     

    function getChatMessage( message, page )
    
    	if message then
    
    		if page == "anonymous" then
    
    			triggerClientEvent( root, "setChatMessage", resourceRoot, "Anonimo: " .. message, page )
    
    		else
    
    			triggerClientEvent( root, "setChatMessage", resourceRoot, getPlayerName( client ) .. ": " .. message, page )
    
    		end
    
    	end
    
    end
    addEvent( "getChatMessage", true )
    addEventHandler( "getChatMessage", resourceRoot, getChatMessage )
    
    
    function distancia( message, page )
    	if message then
    		if page == "local" then
    			local posX1, posY1, posZ1 = getElementPosition(source)
          		for id, player in ipairs(getElementsByType("player")) do
              	local posX2, posY2, posZ2 = getElementPosition(player)
              		if getDistanceBetweenPoints3D(posX1, posY1, posZ1, posX2, posY2, posZ2) <= 10 then
    					triggerClientEvent( root, "setChatMessage", resourceRoot, getPlayerName( client ) .. ": " .. message, page )
    				end
    			end
    		end
    	end				
    end
    
    
    addEvent("executePlayerCommand", true)
    addEventHandler("executePlayerCommand", resourceRoot,
    	function(command, args)
    		if (hasObjectPermissionTo(client, "command."..command, true)) then
    			executeCommandHandler(command, client, args)
    		end
    	end
    )

     

     

    (OBS): Eu tentei adicionar essa função que tá nomeada como "distancia" para fazer com o que a menssagem aparecesse de acordo com certa distância. Não deu certo, preciso da ajuda de alguém!

  7. Eu tentei entender, quebrei cabeça, e não consegui...
    Eu queria que o objeto fosse destruido quando não o player não estivesse mais com arma.

    Como o objeto fica:
    spacer.png

     

     

    OBS:(Quando eu removo a arma de um player, ele continua com a arma no peito, mesmo não tendo ela no slot ou etc...)

    O script:
     

    --local ammoRifle = getPedTotalAmmo ( k, 5 )
    
    local jugadores = {}
    local lplayer = getLocalPlayer()
    local info = {}
    local sx,sy = guiGetScreenSize()
    
    function crearArma(jug,arma)
    	local model = obtenerObjeto(arma)
    	local slot = getSlotFromWeapon(arma)
    	jugadores[jug][slot] = createObject(model,0,0,0)
    	setElementCollisionsEnabled(jugadores[jug][slot],false)
    end
    
    function destruirArma(jug,slot)
    	destroyElement(jugadores[jug][slot])
    	jugadores[jug][slot] = nil
    end
    
    addEventHandler("onClientResourceStart",getResourceRootElement(),function()
    	for k,v in ipairs(getElementsByType("player",root,true)) do
    		jugadores[v] = {}
    		info[v] = {true,isPedInVehicle(v)}
    	end
    end,false)
    
    addEventHandler("onClientPlayerQuit",root,function()
    	if jugadores[source] and source ~= lplayer then
    		for k,v in pairs(jugadores[source]) do
    			destroyElement(v)
    		end
    		jugadores[source] = nil
    		info[source] = nil
    	end
    end)
    
    addEventHandler("onClientElementStreamIn",root,function()
    	if getElementType(source) == "player" and source ~= lplayer then
    		jugadores[source] = {}
    		info[source] = {true,isPedInVehicle(source)}
    	end
    end)
    
    addEventHandler("onClientElementStreamOut",root,function()
    	if jugadores[source] and source ~= lplayer then
    		for k,v in pairs(jugadores[source]) do
    			destroyElement(v)
    		end
    		jugadores[source] = nil
    		info[source] = nil
    	end
    end)
    
    
    function nascer()
    	if jugadores[source] then
    		info[source][1] = true
    	end
    end
    addEventHandler("onClientPlayerSpawn",root, nascer)
    
    function sumirArma()
    	if jugadores[source] then
    		for k,v in pairs(jugadores[source]) do
    			destruirArma(source,k)
    		end
    		info[source][1] = false
    	end
    end
    addEventHandler("onClientPlayerWasted",root, sumirArma)
    
    function sumirArma2()
    local ammoRifle = getPedTotalAmmo(localPlayer, 5) 
    local ammoSniper = getPedTotalAmmo(localPlayer, 6) 
    local armaa = getPedWeapon(localPlayer, 5)
    local armaaSniper = getPedWeapon(localPlayer, 6)
    	if ammoRifle >= 1 then
    		if armaa == 30 or armaa == 31 then
    			setElementData ( localPlayer, "Arma", sim )
    		end	
    	else
    		setElementData ( localPlayer, "Arma", false )	
    	end
    	
    	if ammoSniper >= 1 then
    		if armaaSniper == 34 then
    			setElementData ( localPlayer, "ArmaSniper", sim )
    		end	
    	else
    		setElementData ( localPlayer, "ArmaSniper", false )	
    	end
    end
    addEventHandler("onClientPreRender",root, sumirArma2)
    
    function sumirArma3()
    	if jugadores[source] then
    		for k,v in pairs(jugadores[source]) do
    			destruirArma(source,k)
    		end
    	end
    end
    addEventHandler("onClientPlayerVehicleEnter",root, sumirArma3)
    addEventHandler("onClientPlayerDamage",root, sumirArma3)
    addEventHandler("onClientPlayerVoiceStop",root, sumirArma3)
    addEventHandler("onClientPlayerPickupHit",root, sumirArma3)
    
    addEventHandler("onClientPlayerVehicleEnter",root,function()
    	if jugadores[source] then
    		for k,v in pairs(jugadores[source]) do
    			destruirArma(source,k)
    		end
    		info[source][2] = true
    	end
    end)
    
    
    addEventHandler("onClientPlayerVehicleExit",root,function()
    	if jugadores[source] then
    		info[source][2] = false
    	end
    end)
    
    addEventHandler("onClientPreRender",root,function()
    	for k,v in pairs(jugadores) do
    		local x,y,z = getPedBonePosition(k,3)
    		local rot = math.rad(90-getPedRotation(k))
    		local i = 15
    		local wep = getPedWeaponSlot(k)
    		local ox,oy = math.cos(rot+2.4)*0.22,-math.sin(rot+2.4)*0.22
    		local alpha = getElementAlpha(k)
    		for q,w in pairs(v) do
    			if q == wep then
    				destruirArma(k,q)
    			else
    				setElementRotation(w,0,70,getPedRotation(k)+90)
    				setElementAlpha(w,alpha)
    				if q==2 then
    					
    				elseif q==4 then
    					
    				else
    					setElementPosition(w,x+ox,y+oy,z+0.1)
    					setElementRotation(w,5,58,getPedRotation(k))
    					i=i+15
    				end
    			end
    		end
    		local armado = getElementData( k, "Arma" )
    		local armadoSniper = getElementData( k, "ArmaSniper" )
    		if info[k][1] and not info[k][2] and armado == sim then
    			for i=1,7 do
    				local arma = getPedWeapon(k,i)
    				if arma~=wep and arma>0 and not jugadores[k][i] then
    				if arma == 30 or arma == 31 then
    					crearArma(k,arma)
    				end
    				end
    			end
    		end
    		if info[k][1] and not info[k][2] and armadoSniper == sim then
    			for i=1,7 do
    				local arma = getPedWeapon(k,i)
    				if arma~=wep and arma>0 and not jugadores[k][i] then
    				if arma == 34 then
    					crearArma(k,arma)
    				end
    				end
    			end
    		end
    	end
    end)
    
    function obtenerObjeto(arma)
    	local m
    	if arma > 1 and arma < 9 then
    		m = 331 + arma
    	elseif arma == 9 then
    		m = 341
    	elseif arma == 15 then
    		m = 326
    	elseif (arma > 21 and arma < 30) or (arma > 32 and arma < 39) or (arma > 40 and arma < 44) then
    		m = 324 + arma
    	elseif arma > 29 and arma < 32 then
    		m = 325 + arma
    	elseif arma == 32 then
    		m = 372
    	end
    	return m
    end

     

  8. On 19/04/2021 at 08:16, Boechat said:
    
    local posMarkers = {
        [1] = {x, y, z},  -- x, y e z são as posições dos markers
        [2] = {x, y, z},
        [3] = {x, y, z},
        [4] = {x, y, z},
    }
    
    local markers = {} --Tabela para armazenar os marker para excluir depois
    
    addCommandHandler("marker", function() --Comando para adicionar os markers é /marker
    	for i, value in ipairs(posMarkers) do
    		markers[i] = createMarker(posMarkers[i][1], posMarkers[i][2], posMarkers[i][3], "cylinder", 2.0, 255, 255, 255) --Cria o marker
    	end
    end)
    
    addCommandHandler("removemarker", function() --Comando para remover os markers é /removemarker
    	if type (markers) ~= 'table' or #markers < 1 then return end --Verificando se há marker salvo na tabela markers
    	for i, marker in ipairs(markers) do
    		destroyElement(marker)
    		markers[i] = nil
    	end
    end)

     

    Uma dúvida, os marker's aparecem para todos os jogadores ou para quem digitou o comando ??? No caso eu queria para quem digitou o comando...

     

  9. Eu tenho uma função em que o player digita um comando, e um mark aparece no mapa, nesse script, existem 4 marker's, oque eu posso fazer pra quando ele usar o comando, aparecer um desses 4 marker's aleatorio ???

    Eu espero que tenha dado pra entender kkkk

    ME AJUDEMMM ! :(

  10. 4 minutes ago, LucasST said:
    
    function BreakCam()
        local camera = {getCameraMatrix()}
        setCameraMatrix(unpack(camera))
    end

    Para voltar a camera ao normal utilize o setCameraTarget

    O argumento 1 está boolean, pode me ajudar ??

  11. 14 minutes ago, Boechat said:

    Manda o código aí, e dá um /debugscript 3 e veja se está aparecendo alguma mensagem de erro

    radioSound = { }
    
    addEventHandler("onClientResourceStart", resourceRoot,
    	function()
    		bindKey("r", "down", clientToggleRadio)
    		bindKey("mouse_wheel_up", "down", volumeUp)
    		bindKey("mouse_wheel_down", "down", volumeDown)
    	end
    )
    
    addEventHandler("onClientVehicleEnter", root,
    	function(thePlayer, seat)
    		if getPedOccupiedVehicle ( localPlayer ) ~= false then
    		if thePlayer == getLocalPlayer() then
    			local msg = "Pressione R para ligar a radio. Use a roda do mouse para alterar o volume."
    			if radioSound[source] == nil then
    				outputChatBox(msg, 124, 252, 0)
    			else
    				if radioSound[source].soundElement == nil then
    					outputChatBox(msg, 124, 252, 0)
    				end
    			end
    		end
    	end
    end
    )
    
    addEventHandler("onClientSoundStream", root,
    	function(success, length, streamName)
    		if streamName then
    			local veh = getPedOccupiedVehicle(getLocalPlayer())
    			if veh then
    				if radioSound[veh] == nil then return end
    				if radioSound[veh].soundElement == source then
    					outputChatBox("#696969Rádio: #22AA22 " .. streamName, 0, 0, 0, true)
    				end
    			end
    		end
    	end
    )
    addEventHandler("onClientSoundChangedMeta", root,
    	function(streamTitle)
    		if streamTitle then
    			local veh = getPedOccupiedVehicle(getLocalPlayer())
    			if veh then
    				if radioSound[veh] == nil then return end
    				if radioSound[veh].soundElement == source then
    					outputChatBox("#696969Música: #AA2222 " .. streamTitle, 0, 0, 0, true)
    				end
    			end
    		end
    	end
    )
    
    addEvent("onServerToggleRadio", true)
    addEventHandler("onServerToggleRadio", getLocalPlayer(), 
    	function(toggle, url, veh, volume)	
    		if not isElement(veh) then
    			if radioSound[veh] ~= nil then
    				stopSound(radioSound[veh].soundElement)
    				radioSound[veh].soundElement = nil
    			end
    			return
    		end
    		
    		if toggle == true then
    			local x, y, z = getElementPosition(veh)
    			if radioSound[veh] ~= nil then
    				stopSound(radioSound[veh].soundElement)
    
    				local sound = playSound3D(url, x, y, z)
    				if volume ~= nil then
    					setSoundVolume(sound, volume)
    				end
    				setSoundMinDistance(sound, 6.0)
    				setSoundMaxDistance(sound, 25.0)
    				attachElements(sound, veh)
    				
    				radioSound[veh] = { }
    				radioSound[veh].soundElement = sound
    			else
    				local sound = playSound3D(url, x, y, z)
    				if volume ~= nil then
    					setSoundVolume(sound, volume)
    				end
    				setSoundMinDistance(sound, 6.0)
    				setSoundMaxDistance(sound, 25.0)
    				attachElements(sound, veh)
    				
    				radioSound[veh] = { }
    				radioSound[veh].soundElement = sound
    			end
    		else
    			if radioSound[veh] ~= nil then
    				stopSound(radioSound[veh].soundElement)
    				radioSound[veh].soundElement = nil
    			end
    		end
    	end
    )
    
    addEvent("onServerRadioURLChange", true)
    addEventHandler("onServerRadioURLChange", getLocalPlayer(), 
    	function(newurl, veh, volume)
    		if radioSound[veh] ~= nil then
    			stopSound(radioSound[veh].soundElement)
    		
    			local x, y, z = getElementPosition(veh)
    			local sound = playSound3D(newurl, x, y, z)
    			if volume ~= nil then
    				setSoundVolume(sound, volume)
    			end
    			setSoundMinDistance(radioSound, 6.)
    			setSoundMaxDistance(radioSound, 25.0)
    			attachElements(sound, veh)
    		
    			radioSound[veh] = { }
    			radioSound[veh].soundElement = sound
    		end
    	end
    )
    
    addEvent("onServerVolumeChangeAccept", true)
    addEventHandler("onServerVolumeChangeAccept", getLocalPlayer(), 
    	function(veh, newVolume)
    		if veh then
    			if radioSound[veh] ~= nil then
    				setSoundVolume(radioSound[veh].soundElement, newVolume)
    			end
    		end
    	end
    )
    
    function clientToggleRadio()
    	triggerServerEvent("onPlayerToggleRadio", getLocalPlayer())
    end
    
    function volumeUp()
    	local veh = getPedOccupiedVehicle(getLocalPlayer())
    	if veh then
    		if radioSound[veh] ~= nil then
    			local volume = getSoundVolume(radioSound[veh].soundElement)
    			if volume ~= false then
    				triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, true)
    			end
    		end
    	end
    end
    
    function volumeDown()
    	local veh = getPedOccupiedVehicle(getLocalPlayer())
    	if veh then
    		if radioSound[veh] ~= nil then
    			local volume = getSoundVolume(radioSound[veh].soundElement)
    			if volume ~= false then
    				triggerServerEvent("onPlayerRadioVolumeChange", getLocalPlayer(), volume, false)
    			end
    		end
    	end
    end

     

     

    O debugscript não tá dando problema na parte de ligar a rádio...

  12. 15 minutes ago, Boechat said:

    Esse evento só está mostrando a mensagem para ativar a rádio, não é aí que está ativando de fato. Com certeza tem um bindKey configurando a tecla "R" na função que de fato ativa a rádio, procure ela por ela e use getPedOccupiedVehicle para verificar se o jogar está ocupando um veículo.

    Exemplo:

    
    if getPedOccupiedVehicle ( localPlayer ) ~= false then
    	TODO O CÓDIGO DE ATIVAR A RÁDIO
    end

     

    Não deu certo ?

     

  13. addEventHandler("onClientVehicleEnter", root,
    	function(thePlayer, seat)
    		if thePlayer == getLocalPlayer() then
    			local msg = "Ligar Radio [R]"
    			if radioSound[source] == nil then
    				outputChatBox(msg, 67, 205, 128)
    			else
    				if radioSound[source].soundElement == nil then
    					outputChatBox(msg, 124, 252, 0)
    				end
    			end
    		end
    	end
    )


     

    Eu quero que o player só consiga usar o comando, quando ele estiver dentro do carro. Do jeito que tá ai, ele consegue antes de entrar no carro.
    Alguém me ajuda pfvr !!!

  14. 1 hour ago, Gustavo Freire said:
    
    local mrk = createMarker(-2420.59448, -608.15979, 131.56250, "cylinder", 1.6, 255,0,0, 40)
    
    
    addEventHandler("onClientKey", getRootElement(), 
    function(button, press)
    	if isElementWithinMarker( source, mrk ) then
    		if button == "F1" or "F3" then
    			cancelEvent()
    		end
    	end
    end)

    Não testei mas veja se funciona

    Não funcionou, o script ta no Client

×
×
  • Create New...