Jump to content

Script De Prisão


Recommended Posts

Opa Tudo bom é que eu estou com um script de prisão aki porem ele consegue se auto prender e prender pessoas da mesma tag , gostaria de colocar pra ele n consiguir prender nem ele mesmo ou de forma mais facil de resolver ele n consiguir prender um certo grupo da acl

Link to comment
-------------------------------- Funções Iniciais
viatura = {}
function salvacarro (vei, assento, vitima)
	viatura[source] = vei
end
addEventHandler ('onPlayerVehicleEnter', root, salvacarro)

------ Abrir Prender
local AbrirPainel = createMarker(1570.77722, -1697.50439, 11.98994,"cylinder",2, 0, 60, 160, 60) 

function AbrirPrender (source)
local login = getAccountName(getPlayerAccount(source))
if isObjectInACLGroup("user."..login, aclGetGroup("Policial")) then
triggerClientEvent(source, "TS:AbrirPrender", source)
end
end
addEventHandler("onMarkerHit", AbrirPainel, AbrirPrender)

function Prender (Jogador_Selecionado, getMotivo, getTempo)
local Criminoso = getPlayerFromPartialName(Jogador_Selecionado)
local Estrelas = getPlayerWantedLevel(Criminoso)
local Tempo = tonumber(getTempo)
local Motivo = getMotivo
local jX, jY, jZ = getElementPosition (Criminoso) 
local pX, pY, pZ = getElementPosition (source) 
local IDPolicial = getElementData(source, "ID") or 0
local dist = tonumber(getDistanceBetweenPoints3D ( pX, pY, pZ, jX, jY, jZ)) 
if Tempo == 0 then
outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffDigite o tempo!", source, 255, 0, 0, true )
return end
if dist <= 50 then
if Estrelas >= 1 then
givePlayerMoney(source, 50*Estrelas)
else
givePlayerMoney(source, 50)
end
detachElements(Criminoso, viatura[source])
setElementData(Criminoso, "TempoPrisao", Tempo)
setElementData(Criminoso, "Mtv_Prisao", Motivo)
setElementData(Criminoso, "ID2", IDPolicial)
setElementInterior(Criminoso, 0)
setElementPosition(Criminoso, 1572.03333, -1692.45874, 13.58994)
outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê prendeu o jogador "..getPlayerName(Criminoso).."#ffffff por "..Tempo.." minutos pelo motivo de "..Motivo.." !", source, 255, 0, 0, true )
outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO policial "..getPlayerName(source).." prendeu o jogador "..getPlayerName(Criminoso).."#ffffff por "..Tempo.." minutos pelo motivo de "..Motivo.." !", root, 255, 0, 0, true )
outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê foi preso !", Criminoso, 255, 0, 0, true )
triggerClientEvent(Criminoso, "TS:SendoPreso", Criminoso)
takeAllWeapons(Criminoso)
setPlayerWantedLevel(Criminoso, 0)
setTimer(function()
setElementData(Criminoso, "TempoPrisao", nil)
setElementData(Criminoso, "Mtv_Prisao", nil)
setElementData(Criminoso, "ID2", nil)
setElementData(Criminoso, "TempoPrisao2", nil)
setElementInterior(Criminoso, 0)
setElementPosition(Criminoso, 1539.87463, -1675.75757, 13.54949)
triggerClientEvent(Criminoso, "TS:Liberado", Criminoso)
outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê foi solto !", Criminoso, 255, 0, 0, true )
takeAllWeapons(Criminoso)
setPlayerWantedLevel(Criminoso, 0)
end, Tempo*60000, 1)
end
end
addEvent ("TS:FazerPrisao", true)
addEventHandler ("TS:FazerPrisao", root, Prender)

function Loguei ()
setTimer(function(source)
local Tempo = getElementData(source, "TempoPrisao") or 0
if Tempo >= 1 then
local Tempo2 = getElementData(source, "TempoPrisao2") or 0
local Tempo3 = Tempo2 + 3
    setTimer(function (source)
        if Tempo3 >= 1 then
            setElementInterior(source, 0)
            setElementPosition(source, 1572.03333, -1692.45874, 13.58994)
			setElementData(source, "TempoPrisao", Tempo3)
			setElementData(source, "TempoVolta", Tempo3)
			triggerClientEvent(source, "TS:SendoPreso", source)
			takeAllWeapons(source)
            setPlayerWantedLevel(source, 0)
        end
    end, 3000, 1, source)
    setTimer(function (source)
        if Tempo3 >= 1 then
        setElementData(source, "TempoPrisao", nil)
        setElementData(source, "TempoPrisao2", nil)
        setElementData(source, "Mtv_Prisao", nil)
        setElementData(source, "ID2", nil)
        setElementInterior(source, 0)
        setElementPosition(source, 1539.87463, -1675.75757, 13.54949)
        triggerClientEvent(source, "TS:Liberado", source)
        outputChatBox ( "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê foi solto !", source, 255, 0, 0, true )
		takeAllWeapons(source)
        setPlayerWantedLevel(source, 0)
        end
    end, Tempo3*60000, 1, source)

 

Edited by HG Snuuk
Link to comment

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...