Player Jump Commands

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

Description

This code increases the player's Z velocity when /jump is typed, or increases the Z position when /jump2 is typed.

Code

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

addCommandHandler('jump', function(cmd,args)
	local value = tonumber(args) or 5
	local v = localPlayer.velocity
	localPlayer.velocity = {v.x,v.y,v.z+value}
end)

addCommandHandler('jump2', function(cmd,args)
	local value = tonumber(args) or 5
	local p = localPlayer.position
	localPlayer.position = {p.x,p.y,p.z+value}
end)