SetWeaponRenderEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{New feature/item|3.0161|1.6.0|22880|This function allows you to disable/enable GTA weapon rendering for [[ped]] and [[player]]. It is particularly useful for creating custom weapon systems, where singular weapon ID could have many different models/variations.}}
{{New feature/item|3.0161|1.6.0|22880|This function allows you to completely disable/enable GTA weapon rendering for [[ped]] and [[player]]. It is particularly useful for creating custom weapon systems, where singular weapon ID could have many different models/variations, or to simply get rid of one frame delay when switching weapons.}}
{{Note|If you want to selectively hide weapons use [[engineSetModelLODDistance]] with [https://wiki.multitheftauto.com/wiki/Weapons weapon model ID] and value of '''0.001'''. Do note that game will still process default rendering regardless, which isn't the case when using this function to hide weapon models.}}
{{Tip|You can use it for example with optimized bone_attach resource called [https://github.com/Patrick2562/mtasa-pAttach pAttach].}}
{{Tip|You can use it for example with optimized bone_attach resource called [https://github.com/Patrick2562/mtasa-pAttach pAttach].}}



Latest revision as of 16:59, 10 January 2025

ADDED/UPDATED IN VERSION 1.6.0 r22880:
This function allows you to completely disable/enable GTA weapon rendering for ped and player. It is particularly useful for creating custom weapon systems, where singular weapon ID could have many different models/variations, or to simply get rid of one frame delay when switching weapons.
[[{{{image}}}|link=|]] Note: If you want to selectively hide weapons use engineSetModelLODDistance with weapon model ID and value of 0.001. Do note that game will still process default rendering regardless, which isn't the case when using this function to hide weapon models.
[[{{{image}}}|link=|]] Tip: You can use it for example with optimized bone_attach resource called pAttach.

Syntax

bool setWeaponRenderEnabled ( bool enabled )

Required Arguments

  • enabled: Whether weapon render should be enabled.

Returns

Always returns true.

Example

This example disables weapon rendering once resource has started.

function onClientResourceStartDisableWeaponRender()
	setWeaponRenderEnabled(false)
end
addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStartDisableWeaponRender)

See Also