gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
Fivem Scripting lua how do i enable gta 5 stock police and set a wanted level so the…
- User
Fivem Scripting lua how do i enable gta 5 stock police and set a wanted level so the police chase me
- Assistant
To enable GTA 5 stock police and set a wanted level, you can use the
SetPlayerWantedLevel()native function in a script written in FiveM with LUA programming. Here's an example of a simple script that sets your wanted level to 3, causing police to chase you.- First, create a new folder in your FiveM server's
resourcesdirectory, and name itpoliceChase(or any other name you prefer). - Inside the
policeChasefolder, create a new file named__resource.luaand add the following code:
-- Resource Metadata fx_version 'cerulean' games { 'gta5' } author 'Your_Name' description 'Police Chase Script' version '1.0.0' client_scripts { 'client.lua' }- Next, create another file in the
policeChasefolder calledclient.lua, and add the following code for setting your wanted level:
-- Create a command to set the player's wanted level RegisterCommand('wantedlevel', function(source, args) -- Get the wanted level from the command argument local wantedLevel = tonumber(args[1]) -- Check if the specified wanted level is valid (between 0 and 5) if wantedLevel >= 0 and wantedLevel <= 5 then -- Set the player's wanted level SetPlayerWantedLevel(PlayerId(), wantedLevel, false) SetPlayerWantedLevelNow(PlayerId(), false) -- Notify the player about the new wanted level TriggerEvent('chat:addMessage', { color = {255, 0, 0}, multiline = true, args = {'^1New wanted level:', '^2' .. wantedLevel} }) else TriggerEvent('chat:addMessage', { color = {255, 0, 0}, multiline = true, args = {'^1Error:', '^2Invalid wanted level'} }) end end, false)- After saving the files, go to your server's
server.cfgfile, and add the following line to enable thepoliceChasescript:
ensure policeChase- Start your FiveM server and, once connected, you can use the
/wantedlevelcommand followed by a number between 0 and 5 to set your wanted level. For example, enter/wantedlevel 3to set a wanted level of 3 and have the stock police chase you.
- First, create a new folder in your FiveM server's
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.