Jump to content

[REL] Police and wanted level system


Mr_Moose

Recommended Posts

A complete law and wanted level system in BETA state, it has been running on the AC servers for many months and has been available for a long time as well. The reason for this topic is because of a leak to the community before the official release which got a large amount of downloads and then removed for obvious reasons. The conclusion remains, it seems to bee too popular to be unknown for the world, so let's take the full details:

Download link: (BETA)

http://code.albonius.com/?action=download&id=8523e282173778cc46739ae4405d3784

Features:

  • Contains GUI with skin selection for the police officer job
  • Commands to join SAPD, Army, SWAT and FBI (same as the names with lowercase)
  • A wanted level system that trigger on most kinds of crimes, everything from killing to hitting a mailbox or crashing your car.
  • Hit a wanted player with your nightstick to arrest.
  • Markers in every jail cell (Inside LSPD, SFPD and LVPD) to deliver the arrested player
  • Ability to transport your arrested player in a car without the ability for the suspect to escape.
  • Tazer which forces the suspect down on the floor when getting hit from a short distance
  • Kill arrest on violent suspects (otherwise they'll respawn at the hospital)
  • Data file for easier configuration
  • Exported functions to set trigger a crime and set wanted level, getting distance to nearest cop or criminal etc. to implement your own tracking system.

Installation: (Hard)

The system itself are ready for use but it's dependent on many other resources, alternatively you need to create an extra script file that set's up the rest. See the below list for known configuration requirements, in order to make this work you need some scripting skills as well. That's why it's set to BETA currently.

  • Replace: 'exports["AC_message"]:outputTopBar' with 'outputChatBox' or download our top bar messages resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=8620
  • Add the following teams: "SAPD", "SWAT", "FBI" and "Army". (see law-job.lua)
  • Make sure the element data "Wanted" is set on every player. (Fixed in the most recent version)
  • Download AC vehicle spawn system to get spawners for police vehicles at any police station.
  • Start the resource "interiors" (applies to those servers that doesn't have a way to get inside interiors).

For support and bug reports see: http://games.albonius.com

Link to comment
  • 2 weeks later...
Damn it was hard to install, but I did make it to work after a while, nice resource, thanks.
It's fully depending on your own scripting skills, you need be able to understand eventual errors, if you do then it's easy to install. Most stuff in this works out of the box as well and other stuff are easy to reuse if you want to make a new system but not from scratch.
Link to comment
  • 2 weeks later...
function addTeamData ( ) 
    -- Uncomment these to show information in the scoreboard 
    -- call( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "Occupation", getRootElement(), 110 ) 
    -- call( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "Wanted", getRootElement(), 55 ) 
    -- call( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "Jailed", getRootElement(), 35 ) 
  
    -- Create teams 
    createTeam( "Police", 110, 110, 110 ) 
    createTeam( "SAPD", 110, 110, 110 ) 
    createTeam( "SWAT", 110, 110, 110 ) 
    createTeam( "FBI", 110, 110, 110 ) 
    createTeam( "ArmedForces", 110, 110, 110 ) 
end 
addEventHandler( "onResourceStart", getResourceRootElement(), addTeamData ) 

This is one of the details that has to be fixed, it's handled by an external system in those servers it was built for which isn't published as open source currently, anyway to solve this, all you need to do is to add the above code in any of the server side files, law_job.lua for example within this resource, it will create the included teams (and optionally add some more columns to the scoreboard showing wanted level, if a player is jailed and the occupation) .

That will add the teams when the resource is started, It should be changed within future versions though but until then the above event is the "official" temporary solution to the problem.

Link to comment

There are some errors that flood my debugscript3 .

by the way , can you please explain how the police & wanted system work because i have problems , example a player have wanted level i'm try to arrest or to kill him but i'm getting killed.

Edited by Guest
Link to comment

@Nighttrain All other teams than 'Police' can be accessed by command if you are in a specific group provided by a proper group system, all you need to have is the element data "Group" set to the team with the same name, it's still like that in the newer versions.

@XeoN- It's a complex system so it's either a bug in the tazer or in the vehicle damage control which also causes wanted levels and make people loosing health when crashing their cars. If there are errors flooding your debug script it's most likely in police_client.lua at the bottom where a "onClientRender" event is used to show the distance, might be some missing data in there, try stopping the resource and see what errors you get.

Link to comment

It's not that hard to make it work actually, let's take it step by step shall we.

  • First you need a way to manage the lawgroups, i.e a group system, I recomend this one: https://forum.multitheftauto.com/viewtopic.php?f=108&t=67832
  • Secondly when that is added you need to create a group named SAPD, SWAT, FBI or ArmedForces, and be a member of any of those groups, after that you can use the commands /sapd /swat /fbi or /army to join the law team you wish, now there is also a specific staff group built into this which has access to any of these law groups, and it can simply be changed in the law_job.lua file as well.
  • If you want markers to all the jobs you need to create them by yourself. Only the team 'police' has markers to take the job and a GUI to select skin. Markers are located inside.

Link to comment

in the Data is this

-- Table over vehicle rights, to spawn 
vehRights1 = { 
    -- occupation, team, wanted-level 
    [1]={ "", "", 50 }, 
    [2]={ "Taxi Driver", "Civilians", 2 }, 
    [3]={ "Trucker", "Civilians", 1 }, 
    [4]={ "", "Police", 0 }, 
    [5]={ "Fireman", "Emergency service", 0 }, 
    [6]={ "", "Army", 0 }, 
    [7]={ "Paramedic", "Emergency service", 0 }, 
    [8]={ "Bus Driver", "Civilians", 1 }, 
    [9]={ "Mechanic", "Civilians", 3 }, 
    [10]={ "", "SWAT", 0 }, 
    [11]={ "", "SAPD", 0 }, 
    [12]={ "", "Staff", 0 }, 
    [13]={ "Pilot", "Civilians", 0 }, 
    [14]={ "Tram Driver", "Civilians", 0 }, 
    [15]={ "Train Driver", "Civilians", 0 }, 
    [16]={ "Pilot", "Civilians", 0 }, 
    [17]={ "", "Police", 0 }, 
    [18]={ "", "FBI", 0 }, 
    [19]={ "", "Staff", 0 },  

what do i need to change?

Link to comment

Every line is connected to a set of markers in where you can spawn vehicles, first one is occupation

setElementData(thePlayer, "Occupation", "OCCUPATION_HERE") 

Leave that field blank if you're not using occupation, second column is team, change it to whatever team name you want to give access to the vehicles, and the last one is the highest allowed wanted level, that uses the built in wanted level system.

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