Jump to content

Wanted script [ HELP ]


Sande

Recommended Posts

Posted

I am thinking how i can add 1 star pr = 2kill to this system. Now when i kill i get only 1 star, but then kill again and nothing.

** COPS cant get wanted stars if he didn´t start the "fight".**

Thaanks.

  
--KILL REWARD PER STAR 
kreward = 250 
  
--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 glevel > 0 then 
        destroyBlipsAttachedTo(source) 
    end 
    if ( attacker ) then 
        local wlevel = getPlayerWantedLevel( source ) 
        if wlevel > 0 then 
            theTeam = getPlayerTeam ( attacker ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then 
                setPlayerWantedLevel( source, 0 ) 
                local thisreward = wlevel*kreward 
                givePlayerMoney ( attacker, thisreward ) 
                return 
            end 
        end 
        if ( getElementType( attacker ) == "player" ) then 
            local wlevel = getPlayerWantedLevel( attacker ) 
            if wlevel < 2 then 
                setPlayerWantedLevel( attacker, wlevel+1 ) 
                if wlevel == 1 then 
                    local wblip = createBlipAttachedTo( source, 56 ) 
                end 
            elseif wlevel == 6 then 
             
            end 
        elseif ( getElementType( attacker ) == "vehicle" ) then 
            thekiller = getVehicleController( attacker ) 
            if ( thekiller ) then 
                local wlevel = getPlayerWantedLevel ( thekiller ) 
                if wlevel < 2 then 
                    setPlayerWantedLevel( thekiller, wlevel+1 ) 
                    if wlevel == 1 then 
                        local wblip = createBlipAttachedTo( source, 56 ) 
                    end 
                end 
            end 
        end 
    end 
    --[[setPlayerWantedLevel( source, 0 )--]] 
end 
  
addEventHandler ( "onPlayerWasted", getRootElement(), aplayerdied ) 
  
  
--FUNCTION TO CLEAR BLIPS 
  
function destroyBlipsAttachedTo(player) 
if not isElement(player) then return false end 
local attached = getAttachedElements ( player ) 
    for k,element in ipairs(attached) do 
        if isElement ( element ) and getElementType ( element ) == "blip" then 
            destroyElement ( element ) 
        end 
    end 
end 
  
--WANTED LEVEL IF A POLICE OFFICER IS ATTACKED 
  
function assaultinganofficer ( attacker, weapon, bodypart, loss ) 
    theTeam = getPlayerTeam ( source ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then 
        if ( attacker ) then 
            if ( getElementType( attacker ) == "player" ) then 
                theTeam = getPlayerTeam ( attacker ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then 
                    return 
                end 
            elseif ( getElementType( attacker ) == "vehicle" ) then 
                thedriver = getVehicleController( attacker ) 
                if ( thedriver ) then 
                    theTeam = getPlayerTeam ( thedriver ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" 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 ) 
                        if wlevel == 1 then 
                            local wblip = createBlipAttachedTo( source, 56 ) 
                        end 
                    end 
                elseif ( getElementType( attacker ) == "vehicle" ) then 
                    local thekiller = getVehicleController( attacker ) 
                    if (thekiller) then 
                        local wlevel = getPlayerWantedLevel ( thekiller ) 
                        if wlevel < 1 then 
                            setPlayerWantedLevel( thekiller, wlevel+1 ) 
                            if wlevel == 1 then 
                                local wblip = createBlipAttachedTo( source, 56 ) 
                            end 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
  
addEventHandler ( "onPlayerDamage", getRootElement(), assaultinganofficer ) 
  
function resethurt(source) 
    if (source) then 
        setElementData ( source, "justdamaged", nil ) 
    end 
end 
  
--WANTED LEVEL IF SOMEONE OTHER THAN A COP JACKS SOMEONE 
  
function carjackcheck(theVehicle, seat, jacker) 
    if (jacker) then 
        theTeam = getPlayerTeam ( jacker ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then 
            return 
        end 
        local wlevel = getPlayerWantedLevel( jacker ) 
        if wlevel < 2 then 
            setPlayerWantedLevel( jacker, wlevel+1 ) 
            if wlevel == 1 then 
                local wblip = createBlipAttachedTo( jacker, 56 ) 
            end 
        end 
    end 
end 
  
addEventHandler ( "onPlayerVehicleExit", getRootElement(), carjackcheck ) 
  
--WANTED LEVEL IF NON-COP TRIES TO USE A COP CAR 
  
function copcarcheck(theVehicle, seat, jacked) 
    theTeam = getPlayerTeam ( source ) 
            if  getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then 
        return 
    else 
        local carid =  getVehicleID( theVehicle ) 
        if carid == 598 or carid == 596 or carid == 597 or carid == 427 then 
            local wlevel = getPlayerWantedLevel( source ) 
            if wlevel < 2 then 
                setPlayerWantedLevel( source, wlevel+1 ) 
            end 
        end 
    end 
end 
  
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), copcarcheck ) 
  
--STUFF TO MAKE BRIBE PICKUPS WORK 
  
function pickedUpWantedCheck ( player ) 
    if isElement ( source ) and ( 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 ) 
                    if ( level == 1 ) then 
                        destroyBlipsAttachedTo(player) 
                    end 
                end 
            end 
        end 
    end 
end 
  
addEventHandler ( "onPickupHit", getRootElement(), pickedUpWantedCheck ) 

Posted

getVehicleID

This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be an alternative (usually more generic) way of performing what it once did.

Please use getElementModel

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