Jump to content

[Kill Arrest] When acop kills a criminal, they go dont go jail


VenomOG

Recommended Posts

Client
 

Spoiler

local policeSkins = {
    [280] = true,
    [281] = true,
    [282] = true,
    [283] = true,
    [284] = true,
    [285] = true,
    [286] = true,
    [287] = true,
    [71] = true
}

function arrestCriminal(element)
    if eventName == "onClientPlayerTarget" then
        if isElement(element) and getElementType(element) == "player" then
            if policeSkins[getElementModel(source)] and getElementData(element,"wanted.level") and getDistanceBetweenPoints3D(Vector3(getElementPosition(source)),Vector3(getElementPosition(element))) <= 15 and getElementHealth(element) < 50 and getPedTask(source,"secondary",0) == "TASK_SIMPLE_USE_GUN" then
                triggerServerEvent("NGJobs:setStars",source,element,0)
                setTimer(triggerServerEvent,5000,1,"NGJobs:onPlayerArrested",element)
            end
            if not policeSkins[getElementModel(source)] and policeSkins[getElementModel(element)] and getPedTask(source,"secondary",0) == "TASK_SIMPLE_USE_GUN" then
                triggerServerEvent("NGJobs:setStars",source,_,3)
            end
        end
    elseif eventName == "onClientPlayerWasted" then
        if getElementData(source,"wanted.level") and policeSkins[getElementModel(element)] then
            setTimer(triggerServerEvent,2000,1,"NGJobs:onPlayerArrested",source)
        end
    end
end
addEventHandler("onClientPlayerTarget",localPlayer,arrestCriminal)
addEventHandler("onClientPlayerWasted",localPlayer,arrestCriminal)

Server
 

Spoiler

local jailPosition = {
    {1606.28271,-1678.05237,-29.34375},
    {1606.28271,-1678.05237,-29.34375},
    {1606.28271,-1678.05237,-29.34375}
}

addEvent("NGJobs:setStars",true)
addEventHandler("NGJobs:setStars",getRootElement(),
function(arrested_player,level)
    if arrested_player then
        setPlayerWantedLevel(arrested_player,level)
        toggleAllControls(arrested_player,false)
        setPedAnimation(source,"ped","arrestgun",-1,false)
        setPedAnimation(arrested_player,"ped","handsup",-1,false)
        setTimer(setPedAnimation,2000,1,source)
        setTimer(setPedAnimation,5000,1,arrested_player)
    else
        setPlayerWantedLevel(source,level)
    end
end)

addEvent("NGJobs:onPlayerArrested",true)
addEventHandler("NGJobs:onPlayerArrested",getRootElement(),
function()
    spawnPlayer(source,Vector3(jailPosition[math.random(#jailPosition)]))
    toggleAllControls(source,true)
    setPlayerWantedLevel(source,0)
end)

So the problem is when a cop kills the player they go jail location and lose there guns but there not in dimension or injail. please  help

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