Sooooo… After some Months of LUA learning and to test my “skills” I ceated a personal Version of the Scorpion Trainer from @pongo1231. With many (I think so) funny options. I wanted to share it with you guys to gets some feedback and ideas what I could add or improve.
1.1.2 Minor Bugfixes and Imrovements (Thanks to @siggyfawn for helping)
Added Admin and Normal Version
(Check The server.lua for more Informations about the Admin Version)
1.1.3 Minor Bugfixes
1.1.4 Minor Bugfixes, added the possibility to add more than one Admin and added some new Options
If you find any problems with any of the functions, comment here and inform me about the problem.
I hope you guys like it and I get many feedback and improvement ideas.
Credits: @pongo1231 (Thanks for the “stock” Scorpion Trainer), @siggyfawn (Thanks for some Improvements), some helpful guys from GTAForums and @Flatracer(myself )
Your FPS code scares me. I’m also not sure it’s accurate (I used the steam overlay to test mine). Here’s what I use.
local rgb = {r = 255, g = 153, b = 102}
local prevtime = GetGameTimer()
local prevframes = GetFrameCount()
local fps = -1
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) or not NetworkIsSessionStarted() do
Citizen.Wait(250)
prevframes = GetFrameCount()
prevtime = GetGameTimer()
end
while true do
curtime = GetGameTimer()
curframes = GetFrameCount()
if((curtime - prevtime) > 1000) then
fps = (curframes - prevframes) - 1
prevtime = curtime
prevframes = curframes
end
if IsGameplayCamRendering() and fps >= 0 then
PrintText(fps .. " FPS")
end
Citizen.Wait(1)
end
end)
function PrintText(text)
SetTextColour(rgb.r, rgb.g, rgb.b, 255)
SetTextProportional(1)
SetTextFont(7)
SetTextScale(0.4, 0.68)
SetTextWrap(0.0, 1.0)
SetTextCentre(0)
SetTextDropShadow(0, 0, 0, 0, 0)
SetTextEdge(0, 0, 0, 0, 0)
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(0.89, 0.93)
end
I like the IsGameplayCamRendering() so it doesn’t show during cutscene, teleporting, afk, etc… As for the NetworkIsSessionStarted/NetworkIsPlayerActive, I just don’t like starting client scripts until they’ve fully loaded. I’ve had a native crash the game by not waiting for the session to start. But that’s probably optional. =)
It is not the best way to do it I know haha but it works and it it correct. Anyway I will take a look at yours the next time and maybe use it. Thanks for the Feedback
The nopeds option doesn’t fully work. This is from the rotten V zombies release. If you don’t remove the traffic cars, you’ll still get peds wandering around (they park places and get out). Fairly sure the only way to get rid of all peds, is to call all of these every frame.
-- Thanks to @nobody
Citizen.CreateThread(function()
while true do
-- These natives has to be called every frame.
SetVehicleDensityMultiplierThisFrame(0.0)
SetPedDensityMultiplierThisFrame(0.0)
SetRandomVehicleDensityMultiplierThisFrame(0.0)
SetParkedVehicleDensityMultiplierThisFrame(0.0)
SetScenarioPedDensityMultiplierThisFrame(0.0, 0.0)
local playerPed = GetPlayerPed(-1)
local pos = GetEntityCoords(playerPed)
RemoveVehiclesFromGeneratorsInArea(pos['x'] - 500.0, pos['y'] - 500.0, pos['z'] - 500.0, pos['x'] + 500.0, pos['y'] + 500.0, pos['z'] + 500.0);
-- These natives do not have to be called everyframe.
SetGarbageTrucks(0)
SetRandomBoats(0)
Citizen.Wait(1)
end
end)
I sorta think the ragdoll might be a better solution, but I’d probably add the SetPedConfigFlag(ped, 32, false) also, then if ragdoll is enabled the seatbelt feature will still work. Otherwise enabling ragdoll also disables seatbelt. But like I said in most trainers I’ve seen, the standard seatbelt feature uses the fly thru windscreen config flag.
Also the seatbelt code never checks if playerVeh is valid. And if it is valid, which means he’s inside, what does putting him inside again do? disable ragdoll effects?
SetPedCanRagdoll(playerPed, false) will end any ragdoll effects instantly. I don’t think you need any code after that.
You could also enable a little more realistic seatbelts, if the option is enabled, you disable vehicle seat shuffling.
CanShuffleSeat(vehicle, p1)
Then if you’re in the passenger seat, with seatbelts on, you won’t switch to the driver if he gets out. Which is sorta cool. But it also means no one shuffles seats if 1 person has seatbelts on, but I’m okay with that.