Heal and Fix Command in one

From GTA Connected
Revision as of 21:02, 14 August 2018 by Mex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

This code sets the player's health and armour to 100, and their vehicle health to 1000 and components fixed, when the player types either /heal or /fix.

Code

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

local function healandfix(cmd, args)
	if localPlayer.vehicle then
		localPlayer.vehicle.health = 1000
		localPlayer.vehicle:fix()
	end
	localPlayer.health = 100
	localPlayer.armour = 100
end
addCommandHandler('heal', healandfix)
addCommandHandler('fix', healandfix)