Jump to content

I NEED HELP


alsanfor2014

Recommended Posts

Hello...!

I hold the code and modify it needed Please help me

CODE is a police action

Required...

Helping to work

1_ make the police can not kill a criminal does not have a star or a star or two stars have .. The police can kill a criminal who holds a 3-star or more.

2_ I want to carry Outlaw star Ada police hit my hand.. I want to carry a 3-star Ada criminal police beating my arms.

--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 
    if getPlayerTeam ( attacker ) and getPlayerTeam ( attacker ) == getTeamFromName ( "Police" ) then return end 
        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 isElement(attacker) then 
    if getPlayerTeam ( attacker ) and getPlayerTeam ( attacker ) == getTeamFromName ( "Police" ) then return end 
    if getElementParent(source) == kingCOP 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 getPlayerTeam ( jacker ) and getPlayerTeam ( jacker ) == getTeamFromName ( "Police" ) then return end 
        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 
        if getPlayerTeam ( source ) and getPlayerTeam ( source ) == getTeamFromName ( "Police" ) then return end 
        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 
                       if getPlayerTeam ( element ) and getPlayerTeam ( element ) == getTeamFromName ( "Police" ) then return end 
                        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 
            if getPlayerTeam ( player ) and getPlayerTeam ( player ) == getTeamFromName ( "Police" ) then return end 
                local level = getPlayerWantedLevel(player) 
                if ( level > 0 ) then 
                    setPlayerWantedLevel ( player, level-1 ) 
                end 
            end 
        end 
    end 
end 
addEventHandler ( "onPickupHit", getRootElement(), pickedUpWantedCheck ) 

.....Another View......

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 ) 
local pos = { 
              {1577.5964355469, -1663.8574218750, 554.4553833}, 
              {1578.0511474609, -1658.2720947266, 554.5078125}, 
              {1578.0749511719, -1653.5701904297, 554.5078125}, 
              {1578.4508056641, -1648.8651123047, 554.5078125}, 
              {1577.1477050781, -1644.4810791016, 554.4553833}, 
              {1576.9183349609, -1639.9044189453, 554.4553833}, 
              {1577.1560058594, -1634.3852539063, 554.5078125}, 
              {1555.5535888672, -1634.2465820313, 554.5078125}, 
              {1555.5618896484, -1639.7027587891, 554.4553833}, 
              {1554.8509521484, -1644.3057861328, 554.4553833}, 
              {1555.1500244141, -1649.5153808594, 554.4553833}, 
              {1555.0622558594, -1658.9534912109, 554.4553833}, 
              {1554.9295654297, -1663.7783203125, 554.4553833}, 
              {1576.7573242188, -1658.9750976563, 548.15625}, 
              {1577.0715332031, -1654.1251220703, 548.15625}, 
              {1577.1650390625, -1649.4708251953, 548.15625}, 
              {1577.1300048828, -1644.3162841797, 548.15625}, 
              {1577.5013427734, -1640.1445312500, 548.15625}, 
              {1577.4721679688, -1634.8250732422, 548.15625}, 
              {1555.2098388672, -1634.2298583984, 548.15625}, 
              {1555.2615966797, -1639.5916748047, 548.15625}, 
              {1555.0701904297, -1644.3499755859, 548.15625}, 
              {1555.0847167969, -1648.9716796875, 548.15625}, 
              {1554.9981689453, -1653.9688720703, 548.15625}, 
              {1554.5999755859, -1658.9943847656, 548.15625}, 
              {1554.5999755859, -1658.9943847656, 548.15625}, 
} 
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 >= 3) then 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "ARMY" then 
                local x,y,z = unpack(pos[math.random(#pos)]) 
                setElementPosition(source,x,y,z) 
                theName = getPlayerName ( source ) 
                theCop = getPlayerName ( attacker )   
                outputChatBox ( "You have been jailed by "..theCop.. " for 5 Minutes.", source ) 
                local playeraccount = getPlayerAccount ( attacker ) 
                givePlayerMoney (attacker, 3000) 
                setTimer ( setElementPosition, 300000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)       
                setPlayerWantedLevel (source, 0) 
                end 
            end 
        end 
    end 
    addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 

.....Another View......

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 ) 
local pos = { 
              {1577.5964355469, -1663.8574218750, 554.4553833}, 
              {1578.0511474609, -1658.2720947266, 554.5078125}, 
              {1578.0749511719, -1653.5701904297, 554.5078125}, 
              {1578.4508056641, -1648.8651123047, 554.5078125}, 
              {1577.1477050781, -1644.4810791016, 554.4553833}, 
              {1576.9183349609, -1639.9044189453, 554.4553833}, 
              {1577.1560058594, -1634.3852539063, 554.5078125}, 
              {1555.5535888672, -1634.2465820313, 554.5078125}, 
              {1555.5618896484, -1639.7027587891, 554.4553833}, 
              {1554.8509521484, -1644.3057861328, 554.4553833}, 
              {1555.1500244141, -1649.5153808594, 554.4553833}, 
              {1555.0622558594, -1658.9534912109, 554.4553833}, 
              {1554.9295654297, -1663.7783203125, 554.4553833}, 
              {1576.7573242188, -1658.9750976563, 548.15625}, 
              {1577.0715332031, -1654.1251220703, 548.15625}, 
              {1577.1650390625, -1649.4708251953, 548.15625}, 
              {1577.1300048828, -1644.3162841797, 548.15625}, 
              {1577.5013427734, -1640.1445312500, 548.15625}, 
              {1577.4721679688, -1634.8250732422, 548.15625}, 
              {1555.2098388672, -1634.2298583984, 548.15625}, 
              {1555.2615966797, -1639.5916748047, 548.15625}, 
              {1555.0701904297, -1644.3499755859, 548.15625}, 
              {1555.0847167969, -1648.9716796875, 548.15625}, 
              {1554.9981689453, -1653.9688720703, 548.15625}, 
              {1554.5999755859, -1658.9943847656, 548.15625}, 
              {1554.5999755859, -1658.9943847656, 548.15625}, 
} 
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" or getTeamName( theTeam ) == "ARMY" then 
                local x,y,z = unpack(pos[math.random(#pos)]) 
                setElementPosition(source,x,y,z) 
                theName = getPlayerName ( source ) 
                theCop = getPlayerName ( attacker )   
                outputChatBox ( "You have been jailed by "..theCop.. " for 5 Minutes.", source ) 
                local playeraccount = getPlayerAccount ( attacker ) 
                givePlayerMoney (attacker, 3000) 
                setTimer ( setElementPosition, 300000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)       
                setPlayerWantedLevel (source, 0) 
                end 
            end 
        end 
    end 
    addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 
  

....Another View.....

  
  
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(1568.4700927734,-1678.3664550781,548.15625, "cylinder", 0.01, 0, 0, 255) 
  
  
  
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 
  
  
  

I hope the amendment to the code or files

....(And who did not understand Explain to him again)....

Thank you and I wish success in life to everyone

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