Set Wheel Status

From GTA Connected
Revision as of 19:43, 14 August 2018 by Mex (talk | contribs) (Created page with "{{DISPLAYTITLE:Set Wheel Status}} == Description == This code allows anyone who types the command "/wheel wheel status" whilst in a vehicle, to have the specified status appli...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

This code allows anyone who types the command "/wheel wheel status" whilst in a vehicle, to have the specified status applied to the specified wheel.

Code

Lua, Client-Side, GTAC versions 1.0.72 and newer:

addCommandHandler('wheel', function(cmd,args)
	args = split(args)
	local wheel = tonumber(args[1]) or 0
	local status = tonumber(args[2]) or 3
	localPlayer.vehicle:setWheelStatus(wheel, status)
end)

-- https://stackoverflow.com/questions/1426954/split-string-in-lua
function split(inputstr, sep)
	if sep == nil then
		sep = "%s"
	end
	local t={} ; i=1
	for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
		t[i] = str
		i = i + 1
	end
	return t
end