Jump to content

[AJUDA] Chamado da Policia


Recommended Posts

Posted

Esta dando erro na linha 15,16,17,18,20

function flipVehicle(thePlayer)
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
    local vehicle = getPedOccupiedVehicle(thePlayer)
    if vehicle then
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
            local rX, rY, rZ = getElementRotation(vehicle)
            setElementRotation(vehicle, 0, 0, (rX > 90 and rX < 270) and (rZ + 180) or rZ)
        end
    end
end

addCommandHandler('desvirar', flipVehicle)

function ChamarPolicia (source)
    local x, y, z = getElementPosition(source)
    local loc = getZoneName ( x, y, z )
    local city = getZoneName ( x, y, z, true )
        outputChatBox("#bebebeVocê chamou a policia, aguarde.", source, 255, 255, 255, true)
        for theKey,player in ipairs (getElementsByType("player")) do
            local accName = getAccountName ( getPlayerAccount ( player ) )
            if  isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin") )  then
                outputChatBox("#bebebe"..getPlayerName(source).." precisa de um policial em "..loc.." ("..city..")", player, 255, 255, 255, true)
                local blip = createBlipAttachedTo ( source, 30 )
                setElementVisibleTo(blip, root, false)
                setElementVisibleTo(blip, player, true)
                setTimer ( function()
                    destroyElement(blip)
                end, 270000, 1)
              end
        end
end
addCommandHandler("192", ChamarPolicia)

 

XQWlOmMwSEGFgQFk9Kxg6w.png

  • Moderators
Posted (edited)

Quais erros? Mande por texto, sua imagem não pegou.

Edited by Lord Henry

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted

Warning  s.lua15: Bad argument @ 'getElementPosition' [Expected element at argument 1,got string'192']

Warning  s.lua16: Bad argument @ 'getZoneName' [Expected vector3 at argument 1,got boolean]

Warning  s.lua17: Bad argument  @ 'getZoneName' [Expected vector3 at argument 1,got boolean]

Warning  s.lua18: Bad argument  @ 'outputChatBox' ['Expected boot at argument 5,got number "255"]

ERROR  s.lua20: attempt to call global 'getPlayerAccount' (a nil value)

Posted

Resource está como cliente no meta.xml.

  • Thanks 1

Please do not PM me with scripting related question nor support, use the forums instead.

  • Moderators
Posted

Troque para server. Pois vc está usando funções server-side, que no client não funcionam.

  • Thanks 1

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted (edited)

Server-side

function Virar_Veiculo ( source, Car )
	local cx, cy, cz = getElementPosition ( Car )
	local px, py, pz = getElementPosition ( source )
	local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
	outputChatBox("Carro Virado Com Sucesso.", player, 255, 255, 255, true)
	if ( distance <= 5 ) then	
		local rX, rY, rZ = getElementRotation(Car)
		setElementRotation(Car, 0, 0, (rX > 90 and rX < 270) and (rZ + 180) or rZ)
	end
end
addEvent ("DNL:Virar_Veiculo", true)
addEventHandler ("DNL:Virar_Veiculo", root, Virar_Veiculo)

function ChamarB (source)
    local x, y, z = getElementPosition(source)
    local loc = getZoneName ( x, y, z )
    local city = getZoneName ( x, y, z, true )
        outputChatBox("#bebebeVocê chamou Uma Equipe de Policia, aguarde.", source, 255, 255, 255, true)
        for theKey,player in ipairs (getElementsByType("player")) do
            local accName = getAccountName ( getPlayerAccount ( player ) )
       if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then
                exports.Scripts_Dxmessages:outputDx ( player, "#FF0000[COBOM]  #FFFFFF"..getPlayerName(source).." #FFFFFF precisa de uma Equipe de Policia em "..loc.." ("..city..")", "warning" )
                local blip = createBlipAttachedTo ( source, 30 )
                setElementVisibleTo(blip, root, false)
                setElementVisibleTo(blip, player, true)
                setTimer ( function()
                    destroyElement(blip)
                end, 270000, 1)
              end
        end
end
addCommandHandler("190", ChamarB)

Client-Side

function Click_Repair ( _, state, _, _, _, _, _, ClickCar)
	if state == "down" then
		if ( ClickCar ) then
			if ( getElementType ( ClickCar ) == "vehicle" ) then
				triggerServerEvent("DNL:Virar_Veiculo", root, localPlayer, ClickCar )
			end
		end
	end
end
addEventHandler("onClientClick", root, Click_Repair)

Como faço pra adicionar um tempo junto com uma animaçao Para o carro virar e pra uma certa acl poder ter esse acesso do Click

Edited by Hize
Posted
28 minutes ago, Jonas^ said:

Mostre como você tentou.

function Virar_Veiculo ( source, Car )
	local cx, cy, cz = getElementPosition ( Car )
	local px, py, pz = getElementPosition ( source )
	local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
	outputChatBox("Carro Virado Com Sucesso.", player, 255, 255, 255, true)
	if ( distance <= 5 ) then	
		local rX, rY, rZ = getElementRotation(Car)
		setTimer(function()
		setElementRotation(Car, 0, 0, (rx > 90 and rx < 270) and (rz + 100) or rz)
		end, 120000, 1)
	end
end
addEvent ("DNL:Virar_Veiculo", true)
addEventHandler ("DNL:Virar_Veiculo", root, Virar_Veiculo)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...