Skip to content

Commit 776a64e

Browse files
authored
Merge pull request #57 from Disinterpreter/amx-vehicle-component
GetVehicleComponentType
2 parents 060ff98 + 50728b6 commit 776a64e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

amx/server/syscalls.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,49 @@ function SetTrainSpeed(amx, train, speed)
26082608
return setTrainSpeed(train, speed)
26092609
end
26102610

2611+
-- 0 - CARMODTYPE_SPOILER
2612+
-- 1 - CARMODTYPE_HOOD
2613+
-- 2 - CARMODTYPE_ROOF
2614+
-- 3 - CARMODTYPE_SIDESKIRT
2615+
-- 4 - CARMODTYPE_LAMPS
2616+
-- 5 - CARMODTYPE_NITRO
2617+
-- 6 - CARMODTYPE_EXHAUST
2618+
-- 7 - CARMODTYPE_WHEELS
2619+
-- 8 - CARMODTYPE_STEREO
2620+
-- 9 - CARMODTYPE_HYDRAULICS
2621+
-- 10 - CARMODTYPE_FRONT_BUMPER
2622+
-- 11 - CARMODTYPE_REAR_BUMPER
2623+
-- 12 - CARMODTYPE_VENT_RIGHT
2624+
-- 13 - CARMODTYPE_VENT_LEFT
2625+
function GetVehicleComponentType(amx, componentid)
2626+
local components = {
2627+
['Spoiler'] = 0,
2628+
['Hood'] = 1,
2629+
['Roof'] = 2,
2630+
['Sideskirt'] = 3,
2631+
['Headlights'] = 4,
2632+
['Nitro'] = 5,
2633+
['Exhaust'] = 6,
2634+
['Wheels'] = 7,
2635+
['Stereo'] = 8,
2636+
['Hydraulics'] = 9,
2637+
['Front Bumper'] = 10,
2638+
['Rear Bumper'] = 11,
2639+
2640+
-- TODO:
2641+
-- 12 - CARMODTYPE_VENT_RIGHT
2642+
-- 13 - CARMODTYPE_VENT_LEFT
2643+
['Vent'] = 12
2644+
}
2645+
local componentName = getVehicleUpgradeSlotName (componentid)
2646+
2647+
local componentId = components[componentName]
2648+
if tonumber(componentId) ~= nil then
2649+
return componentId
2650+
else
2651+
return -1
2652+
end
2653+
end
26112654
-----------------------------------------------------
26122655
-- Water
26132656
function GetWaveHeight(amx)
@@ -3526,6 +3569,7 @@ g_SAMPSyscallPrototypes = {
35263569
SetTrainDirection = {'v', 'b'},
35273570
GetTrainSpeed = {'v', 'r'},
35283571
SetTrainSpeed = {'v', 'f'},
3572+
GetVehicleComponentType = {'i'},
35293573

35303574
-- pickups
35313575
GetPickupType = {'u'},

0 commit comments

Comments
 (0)