Jump to content

[help]Police-Job


Bluntz-X

Recommended Posts

hi all this police job download from community anybody tell how i make which police arrest criminal..criminal follow this police and police hit the marker criminal teleport in jail .and show the reammaing time.anybody help me...

Client

  
  
GUIEditor = { 
    memo = {}, 
    button = {}, 
    window = {}, 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0.29, 0.24, 0.42, 0.49, "", true) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1], false) 
  
        bAccept = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "", true, GUIEditor.window[1]) 
         
        bAccept = guiCreateButton(0.60, 0.20, 0.34, 0.17, "Accept Job", true, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "sa-header") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
        addEventHandler("onClientGUIClick", bAccept, showGUIbf, false) 
        addEventHandler("onClientGUIClick", bAccept, joinTeam, false) 
         
        bClose = guiCreateButton(0.67, 0.61, 0.20, 0.16, "CLOSE", true, GUIEditor.window[1]) 
        guiSetProperty(bClose, "NormalTextColour", "FFAAAAAA")  
        addEventHandler("onClientGUIClick", bClose, showGUIbf, false) 
         
        GUIEditor.memo[1] = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "This is Police Job/n/Press Accept to take the job if you don't want to press cancel.", true, GUIEditor.window[1]) 
         
    end 
) 
  
local joinBD = createMarker(1540.70459, -1634.32251, 12.54688, "cylinder", 2.5, 0, 170, 0) 
  
  
  
addEventHandler( "onClientResourceStart", getRootElement( ), 
    function ( startedRes ) 
        createBlipAttachedTo( joinBD, 30); 
    end 
); 
  
function showGUIbt(hitElement) 
 if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
 guiSetVisible(GUIEditor.window[1], true) 
 showCursor( true ) 
 end 
 end 
 addEventHandler("onClientMarkerHit", joinBD, showGUIbt)  
  
function showGUIbf() 
    guiSetVisible (GUIEditor.window[1], false ) 
    showCursor ( false ) 
end 
  
  
function joinTeam() 
    triggerServerEvent("Police.saPDj", localPlayer, "teamSet") 
end 
  
  
  

server

Teame = createTeam("Police", 0, 0, 255) 
CT = { [Teame] = true } 
CV = { [596] = true } 
  
function CopCar () 
    setModelHandling(596, "driveType", "awd") 
    setModelHandling(596, "engineType", "electric") 
    setModelHandling(596, "numberOfGears", 3) 
    setModelHandling(596, "collisionDamageMultiplier", 0.10) 
end 
addEventHandler("onResourceStart",resourceRoot,CopCar) 
  
function PoliceSet () 
    local team = getTeamFromName ( "Police" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 0, 255 ) 
            setElementModel(source, 281) 
            outputChatBox("Welcome to the Police Job (by Price).",thePlayer)         
        else  
            local teamx = getTeamFromName ( "Police" ) 
            if teamx then 
            cancelEvent() 
            outputChatBox("You do not need to use this again!", thePlayer) 
        end 
    end 
end 
addEvent("Police.saPDj", true) 
addEventHandler("Police.saPDj", root, PoliceSet ) 
  
         
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
        if ( CV[getElementModel ( source )] ) and ( not CT[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
            removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
            outputChatBox("Only cops can use this car!", thePlayer) 
            setPlayerWantedLevel(thePlayer,3) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
function policeJob ( attacker, attackerweapon, bodypart, loss ) 
 if attacker and getElementType(attacker) == "player" then 
        theTeam = getPlayerTeam ( attacker ) 
        theWL = getPlayerWantedLevel ( source ) 
        theSkin = getElementModel ( attacker ) 
        if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then 
                setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) 
                theName = getPlayerName ( source ) 
                theCop = getPlayerName ( attacker )   
                outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) 
                local playeraccount = getPlayerAccount ( attacker ) 
                givePlayerMoney (attacker, 100) 
                setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)       
                setPlayerWantedLevel (source, 0) 
                end 
            end 
        end 
    end 
    addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 
  

wantedlevels

--WANTED LEVEL IF A PLAYER IS MURDERED BY A NON-COP, OR IF AN INNOCENT PERSON IS MURDERED BY A COP 
function aplayerdied( ammo, attacker, weapon, bodypart ) 
    local glevel = getPlayerWantedLevel ( source ) 
    if isElement(attacker) then 
        local wlevel = getPlayerWantedLevel( source ) 
        if wlevel > 0 then 
            if getElementParent(attacker) == kingCOP then 
                setPlayerWantedLevel( source, 0 ) 
            end 
        end 
        if ( getElementType( attacker ) == "player" ) then 
            local wlevel = getPlayerWantedLevel( attacker ) 
            if wlevel < 6 then 
                setPlayerWantedLevel( attacker, wlevel+1 ) 
            end 
        elseif ( getElementType( attacker ) == "vehicle" ) then 
            thekiller = getVehicleController( attacker ) 
            if isElement(thekiller) then 
                local wlevel = getPlayerWantedLevel ( thekiller ) 
                if wlevel < 6 then 
                    setPlayerWantedLevel( thekiller, wlevel+1 ) 
                end 
            end 
        end 
    end 
    setPlayerWantedLevel( source, 0 ) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), aplayerdied ) 
  
--WANTED LEVEL IF A POLICE OFFICER IS ATTACKED 
function assaultinganofficer ( attacker, weapon, bodypart, loss ) 
    if getElementParent(source) == kingCOP then 
        if isElement(attacker) then 
            if ( getElementType( attacker ) == "player" ) then 
                if getElementParent(attacker) == kingCOP then 
                    return 
                end 
            elseif ( getElementType( attacker ) == "vehicle" ) then 
                thedriver = getVehicleController( attacker ) 
                if isElement(thedriver) then 
                    if getElementParent(thedriver) == kingCOP then 
                        return 
                    end 
                end 
            end 
            if (getElementData ( source, "justdamaged" ) ~= "yes") and (source ~= attacker) then 
                setElementData ( source, "justdamaged", "yes" ) 
                local damagereset = setTimer ( resethurt, 20000, 1, source ) 
                if ( getElementType( attacker ) == "player" ) then 
                    local wlevel = getPlayerWantedLevel( attacker ) 
                    if wlevel < 1 then 
                        setPlayerWantedLevel( attacker, wlevel+1 ) 
                    end 
                elseif ( getElementType( attacker ) == "vehicle" ) then 
                    local thekiller = getVehicleController( attacker ) 
                    if isElement(thekiller) then 
                        local wlevel = getPlayerWantedLevel ( thekiller ) 
                        if wlevel < 1 then 
                            setPlayerWantedLevel( thekiller, wlevel+1 ) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement(), assaultinganofficer ) 
  
function resethurt(source) 
    if isElement(source) then 
        setElementData ( source, "justdamaged", "none" ) 
    end 
end 
  
--WANTED LEVEL IF SOMEONE OTHER THAN A COP JACKS SOMEONE 
function carjackcheck(theVehicle, seat, jacker) 
    if isElement(jacker) then 
        if getElementParent(jacker) == kingCOP then 
            return 
        end 
        local wlevel = getPlayerWantedLevel( jacker ) 
        if wlevel < 4 then 
            setPlayerWantedLevel( jacker, wlevel+1 ) 
        end 
    end 
end 
addEventHandler ( "onPlayerVehicleExit", getRootElement(), carjackcheck ) 
  
--WANTED LEVEL IF NON-COP TRIES TO USE A COP CAR 
function copcarcheck(theVehicle, seat, jacked) 
    if getElementParent(source) == kingCOP then 
        return 
    else 
        local carid =  getElementModel( theVehicle ) 
        if carid == 598 or carid == 596 or carid == 597 or carid == 427 or carid == 490 or carid == 599 then 
            if (getElementData ( source, "currentstatus" ) ~= "underarrest" ) then 
                local wlevel = getPlayerWantedLevel( source ) 
                if wlevel < 4 then 
                    setPlayerWantedLevel( source, wlevel+1 ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), copcarcheck ) 
  
  
-- WANTED LEVEL IF A COP SEES SOMEONE DOING SOMETHING ILLEGAL 
-- TO MAKE THIS WORK WITH YOUR SCRIPT, SET A PLAYERS ELEMENT DATA "legalstatus" TO "illegal" WHILE DOING SOMETHING ILLEGAL 
-- DONT FORGET TO CHANGE IT TO SOMETHING ELSE AFTERWARDS THOUGH!! 
function inspection ( element ) 
    if isElement(element) then 
        if ( getElementType ( element ) == "player" ) then 
            if getElementParent(source) == kingCOP then 
                local wlevel = getPlayerWantedLevel( source ) 
                if wlevel == 0 then 
                    if (getElementData ( element, "legalstatus" ) == "illegal" ) then 
                        local cx, cy, cz = getElementPosition ( source ) 
                        local px, py, pz = getElementPosition ( element ) 
                        if ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 15 ) then 
                            setPlayerWantedLevel ( element, 1 ) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), inspection ) 
  
--STUFF TO MAKE BRIBE PICKUPS WORK 
function pickedUpWantedCheck ( player ) 
    if ( getElementType(source) == "pickup" ) then 
        if getPickupType ( source ) == 3 then 
            if (getElementData ( source, "model" ) == "1247" ) then 
                local level = getPlayerWantedLevel(player) 
                if ( level > 0 ) then 
                    setPlayerWantedLevel ( player, level-1 ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onPickupHit", getRootElement(), pickedUpWantedCheck ) 
  

here is marker where police hit maker criminal teleport in jail

createMarker = ((587.85107, -635.79315, 22.81306, "cylinder", 2.5, 0, 170, 0) 

here jail maker where criminal teleport

createMarker = (1259.77979, 2068.58154, 32.63382, "cylinder", 2.5, 0, 170, 0) 

pls tell how i make it

Link to comment

well, i didn't read your whole code, but here is the correction for the last two things:

  
createMarker = ((587.85107, -635.79315, 22.81306, "cylinder", 2.5, 0, 170, 0) 
  

this wont work, it must be

  
markerName = createMarker(587.85107, -635.79315, 22.81306, "cylinder", 2.5, 0, 170, 0) 
  

and to take the criminal to the jail use

  
spawnPlayer --Server side 
  

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