ScriptingExamples/HealAndFixInOne: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
 
(No difference)

Latest revision as of 21:02, 14 August 2018

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)