├── fxmanifest.lua
├── README.md
└── client.lua
/fxmanifest.lua:
--------------------------------------------------------------------------------
1 | fx_version 'bodacious'
2 |
3 | game 'gta5'
4 |
5 | client_scripts {
6 | 'client.lua'
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # tw1st0R- ANTIPOWERGAMING Script used with any FRAMEWORK
4 |
5 | Improved off of the newest ANTIPOWERGAMING Script. Written in .lua
6 |
7 | Runs at ~ 0.00 to 0.01 ms if you have more optimization suggestions feel free to reach out.
8 |
9 | # Follow me in my Social Networks
10 | * [YOUTUBE](https://www.youtube.com/channel/UChRcrcs1EZna4hGIn1KD3cw)
11 | * [TWITCH](https://www.twitch.tv/tw1st0R_)
12 | * [GitHub Profile](https://github.com/twist0R)
13 |
14 | # Installation
15 | * **just put in your server.cfg " ensure antipowergamingbykurat420 "**
16 |
17 | # Features
18 | * Loss of vehicle traction in sand and hills
19 | * Emergency Service Vehicles Have Less Traction Loss)
20 | * OFFROAD and SUV cars also have more traction control
21 | * If you use core_vehicle when changing "Michelin tire " you will have more traction / vehicle control
22 | #
23 |
24 | # Previews
25 | ### VEHICLE CONTROL / TRACTION
26 | 
27 | ### CONSOLE LOGS
28 | 
29 | ### Impact on driving when using a sports vehicle on offroad terrain
30 | 
31 | ### RESOURCE MS
32 | 
33 |
34 | # Issues and Suggestions
35 | Please use the GitHub issues system to report issues or make suggestions, when making suggestion, please keep [Suggestion] in the title to make it clear that it is a suggestion.
36 |
37 |
--------------------------------------------------------------------------------
/client.lua:
--------------------------------------------------------------------------------
1 | local vehicle = nil
2 | local isDriver = false
3 | local fTractionLossMult = nil
4 | local isModed = false
5 | local class = nil
6 | local isBlacklisted = false
7 | local classMod = {
8 | [0]= 2.51, -- Compacts
9 | [1] = 2.51, --Sedans
10 | [2] = 1.01, --SUVs
11 | [3] = 2.51, --Coupes
12 | [4] = 2.501, --Muscle
13 | [5] = 2.51, --Sports Classics
14 | [6] = 2.51, --Sports
15 | [7] = 2.51, --Super
16 | [8] = 1.51, --Motorcycles
17 | [9] = 0, --Off-road
18 | [10] = 0, --Industrial
19 | [11] = 0, --Utility
20 | [12] = 2.21, --Vans
21 | [13] = 0, --Cycles
22 | [14] = 0, --Boats
23 | [15] = 0, --Helicopters
24 | [16] = 0, --Planes
25 | [17] = 0, --Service
26 | [18] = 2.21, --Emergency
27 | [19] = 0, --Military
28 | [20] = 2.21, --Commercial
29 | [21] = 0 --Trains
30 | }
31 | local blackListed = {
32 | 788045382, --"sanchez"
33 | -1453280962,--"sanchez2"
34 | 1753414259, --"enduro"
35 | 2035069708,--"esskey"
36 | 86520421,--"bf400"
37 | -488123221,--"predator"
38 | -1536924937,--"policeold1"
39 | -1647941228,--"fbi2"
40 | 353883353,--"polmav"
41 | 469291905,--"lguard"
42 | 1475773103, --Rumpo3
43 | 1977528411, --Scoutpol
44 | 1570619963, --ktm policia
45 | 610904671, -- insurgency
46 | -561505450, --scpd4
47 | -1286617882, --scpd5
48 | -271532569, --scpd7
49 | -879194100, --umkscout
50 | }
51 | Citizen.CreateThread(function()
52 | while true do
53 | local ped = GetPlayerPed(-1)
54 | if IsPedInAnyVehicle(ped, false) then
55 | if vehicle == nil then
56 | vehicle = GetVehiclePedIsUsing(ped)
57 | if GetPedInVehicleSeat(vehicle, -1) == ped then
58 | isDriver = true
59 | if DecorExistOn(vehicle, 'fTractionLossMult') then
60 | fTractionLossMult = DecorGetFloat(vehicle, 'fTractionLossMult')
61 | print("Existe um valor padrão: "..fTractionLossMult)
62 | else
63 | fTractionLossMult = GetVehicleHandlingFloat(vehicle, 'CHandlingData', 'fTractionLossMult')
64 | DecorRegister('fTractionLossMult', 1)
65 | DecorSetFloat(vehicle,'fTractionLossMult', fTractionLossMult)
66 | print("O valor padrão é criado: "..fTractionLossMult)
67 | end
68 | class = GetVehicleClass(vehicle)
69 | isBlacklisted = isModelBlacklisted(GetEntityModel(vehicle))
70 | end
71 | end
72 | else
73 | if vehicle ~= nil then
74 | if DoesEntityExist(vehicle) then
75 | setTractionLost (fTractionLossMult)
76 | end
77 | Citizen.Wait(1000)
78 | vehicle = nil
79 | isDriver = false
80 | fTractionLossMult = nil
81 | isModed = false
82 | class = nil
83 | isBlacklisted = false
84 | end
85 | end
86 | Citizen.Wait(2000)
87 | end
88 | end)
89 | Citizen.CreateThread(function()
90 | while true do
91 | if isBlacklisted == false then
92 | if vehicle ~= nil and isDriver == true then
93 | local speed = GetEntitySpeed(vehicle)*3.6
94 | if not pointingRoad(vehicle) then
95 | if groundAsphalt() or speed <= 35.0 then
96 | if isModed == true then
97 | isModed = false
98 | setTractionLost (fTractionLossMult)
99 | end
100 | else
101 | if isModed == false and speed > 35.0 then
102 | isModed = true
103 | setTractionLost (fTractionLossMult + classMod[class])
104 | end
105 | end
106 | else
107 | if isModed == true then
108 | isModed = false
109 | setTractionLost (fTractionLossMult)
110 | end
111 | end
112 | end
113 | end
114 | Citizen.Wait(500)
115 | end
116 | end)
117 | function setTractionLost (value)
118 | if isBlacklisted == false and vehicle ~= nil and value ~= nil then
119 | SetVehicleHandlingFloat(vehicle, 'CHandlingData', 'fTractionLossMult', value)
120 | print("fTractionLossMult: "..value)
121 | end
122 | end
123 | function isModelBlacklisted(model)
124 | local found = false
125 | for i = 1, #blackListed do
126 | if blackListed[i] == model then
127 | found = true
128 | break
129 | end
130 | end
131 | return found
132 | end
133 | function groundAsphalt()
134 | local ped = PlayerPedId()
135 |
136 | local playerCoord = GetEntityCoords(ped)
137 | local target = GetOffsetFromEntityInWorldCoords(ped, vector3(0,2,-3))
138 | local testRay = StartShapeTestRay(playerCoord, target, 17, ped, 7) -- This 7 is entirely cargo cult. No idea what it does.
139 | local _, hit, hitLocation, surfaceNormal, material, _ = GetShapeTestResultEx(testRay)
140 |
141 | if hit and material == 282940568 then
142 | return true
143 | end
144 | return false
145 | end
146 | function pointingRoad(veh)
147 | local pos = GetEntityCoords(veh, true)
148 | if IsPointOnRoad(pos.x,pos.y,pos.z-1,false) then
149 | return true
150 | end
151 | local pos2 = GetOffsetFromEntityInWorldCoords(veh, 1.5, 0, 0)
152 | local pos3 = GetOffsetFromEntityInWorldCoords(veh, -1.5, 0, 0)
153 | if IsPointOnRoad(pos2.x,pos2.y,pos2.z-1,false) then
154 | return true
155 | end
156 | if IsPointOnRoad(pos3.x,pos3.y,pos3.z,false) then
157 | return true
158 | end
159 | return false
160 | end
161 |
--------------------------------------------------------------------------------