Putting in fix for AI vehicles despawning and leaving driver behind when far from all human players. Adding blips on mini map/waypoint map to track other players/AI while race is running.
Thank you! i was wondering why i keep seeing peds in the middle of the road.
Hello comrades!
-
I would really like it to be possible to tune AIās vehicles before the race and the tuning to be saved together with the race, with the botsā vehicles so as not to spawn them constantly: please give players an opportunity to be able to sit in a passenger seat, or something like that, and load necessary tuning from any cheat-menu.
-
It would also be nice if bots werenāt afraid of players when the players accidentally aim at them and they didnāt run away in different directions. However this is probably the best script for racing in FiveM at the moment! I hope some of this will get into one of the next updates
Fix for AI vehicles despawning and addition of blips to track rival players added to latest version of scripts.
Is there any chance you have the script available for QBcore?
Sorry, I donāt know what QBcore is. My scripts should work well for any framework. The only things that would need to be ported to a framework is the financial functions found in the āport.luaā file. There is an ESX version of the financial functions in the āesxā directory of the github link in my original first post.
If you see any thing that looks like an issue, Iād appreciate if you let me know so I can work on it. Thanks for using and testing it.
Hi Person-01359,
- It would be a considerably more work than Iām willing to do. Iād like to keep things as simple as I can.
- If more people want AI not to be afraid, I might be able to do it.
At least give players the opportunity to get into the botsā cars before the race and add buttons to switch between 3 panels, please.
Is it difficult to make that notifications arenāt shown in the chat when the panel is opened (because there is Reply Panel)? Is it reasonable?
Buttons to switch between the panels sounds like a good idea. Iāll have to figure out how to let a player enter a car without kicking out the driver.
Part of the reason I have stuff show up in chat is because once a reply panel closes, there is no way to see what was on the reply panel again. Putting it in chat lets you see what the reply was.
it seems to me that the lack of flood in the chat is more important in this case, because you can use commands in the chat for debugging, and the panel is designed for convenience and simplicity
If more than a couple of people see this as an issue, Iāll consider changing it. You can modify the following function in races_client.lua to achieve this, I think (Iām not absolutely sure this wonāt break something. Iād have to look more closely).
Change:
local function sendMessage(msg)
if true == panelShown then
local html = string.gsub(msg, "\n", "<br>")
SendNUIMessage({
panel = "reply",
message = html
})
end
notifyPlayer(msg)
end
to
local function sendMessage(msg)
if true == panelShown then
local html = string.gsub(msg, "\n", "<br>")
SendNUIMessage({
panel = "reply",
message = html
})
else
notifyPlayer(msg)
end
end
Thanks a lot!
Players can ride as passengers in AI controlled vehicles. All panels have buttons that allow the user to open other 2 panels. Latest version at link in original post.
Added a utility script to allow players to teleport:GitHub - emtneutrino/teleport
Suddenly, someone will need the function of changing the driving style of bots without exiting the game for debugging:
Š”ommand: /races dstyle [number of style]
https://vespura.com/fivem/drivingstyle/
INSTALLING:
Add this somewhere at the beginning of the code from a new line (default style 1076625980):
local DrivingStyle = 1076625980
Add this somewhere before the Register Command function to the free space from a new line:
local function changeDrivingStyle(dstyle)
dstyle = math.tointeger(tonumber(dstyle))
if dstyle ~= nil and dstyle >= 0 and dstyle <= 2147483647 then
DrivingStyle = dstyle
notifyPlayer("Driving style have been changed")
else
notifyPlayer("Invalid value of driving style")
end
end
Add this in RegisterCommand function under any of the elseifs:
elseif "dstyle" == args[1] then
changeDrivingStyle(args[2])
Change:
TaskVehicleDriveToCoord(driver.ped, driver.vehicle, driver.destWP.x, driver.destWP.y, driver.destWP.z, 70.0, 1.0, GetEntityModel(driver.vehicle), 787004, driver.destWP.r * 0.5, true)
To:
TaskVehicleDriveToCoord(driver.ped, driver.vehicle, driver.destWP.x, driver.destWP.y, driver.destWP.z, 300.0, 1.0, GetEntityModel(driver.vehicle), DrivingStyle, driver.destWP.r * 1.0, true)
Is it possible to draw circles somehow, and not rectangles? )
if elapsedTime > -countdown * 1000 then
drawLights = true
countdown = countdown - 1
PlaySoundFrontend(-1, "MP_5_SECOND_TIMER", "HUD_FRONTEND_DEFAULT_SOUNDSET", true)
if IsPedInAnyVehicle(player, false) == 1 then
FreezeEntityPosition(GetVehiclePedIsIn(player, false), true)
end
end
if true == drawLights then
for i = 0, 4 - countdown do
if i == 0 then
drawRect(0.05, 0.1, 0.1, 0.175, 0, 200, 0, 255)
end
if i == 1 then
drawRect(0.25, 0.1, 0.1, 0.175, 100, 200, 0, 255)
end
if i == 2 then
drawRect(0.45, 0.1, 0.1, 0.175, 200, 200, 0, 255)
end
if i == 3 then
drawRect(0.65, 0.1, 0.1, 0.175, 200, 100, 0, 255)
end
if i == 4 then
drawRect(0.85, 0.1, 0.1, 0.175, 200, 0, 0, 255)
end
end
end
Iām guessing youāve made some changes to the code. Do you have a link to your changes where I can have a look? Iāll do some more testing of my code.
You could draw a sphere with DrawSphere, but they would exist in the 3d world. They would not be in front of you if you looked in a different direction.