Skip to content

Add additional setWeaponProperty customizations#4691

Open
DeValdi wants to merge 1 commit intomultitheftauto:masterfrom
DeValdi:feature/additional-weapon-customization
Open

Add additional setWeaponProperty customizations#4691
DeValdi wants to merge 1 commit intomultitheftauto:masterfrom
DeValdi:feature/additional-weapon-customization

Conversation

@DeValdi
Copy link

@DeValdi DeValdi commented Feb 6, 2026

Summary

  • An additional skill level can be accessed by the setWeaponProperty function by using "special" as the target.
  • The "anim_group" weapon property can be changed (expects numerial ID as integer).
  • By default, the properties of all "special" skill levels, excecpt the pistol's, are equal to their "pro" counterpart.
  • The pistol's properties are already the one's from the "colt_cop" configuration.
  • A ped can be given this skill level by setting the corresponding weapon stat to 5000.

Motivation

  • closes Add "anim_group" to setWeaponProperty() #609
  • I see a lot of "ugly" workarounds on roleplay servers that want something simple like holding a single pistol with both hands or holding the sawed-off like a normal shotgun.
  • In most cases, developers resort to making the weapon model of the "animation gun" invisible and attaching custom weapons to the ped bones.
  • More often than not, this entails even more logic for keeping track of ammo, proper aiming, etc.
  • In the worst case, performance and frame rate suffers for constantly synchronizing moving objects, as is the case with a rotating player.
  • In my opinion, this can be solved much more elegantly by simply allowing developers to change the animation group of weapons.
  • By bringing an additional, natively fully supported weapon skill level into the mix, this is also "free" of charge for most use cases.
  • E.g. it is now possible to support a one-handed "gangster" grip, two-handed "cop" grip, two-handed "hitman" grip (no recoil, i.e. the silenced pistol animation) and dual-wielding all with the same Colt45 weapon, without any weird workarounds.

Test plan

I did some very basic testing on a Windows device by giving my in-game character weapons and switching between the skill levels. It seems to work for me, but that is of course not to say that it does for everyone. I appreciate any feedback or concerns on this new mechanism.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

This change unlocks the "anim_group" weapon property's setter and gives
access to the natively supported fourth skill level ("special").

The two changes complement each other, since developers are more likely
to use the first feature (i.e. an additional weapon animation) if it
means not overriding an already in-use skill level.

To specify the "special" skill level as the target of setWeaponProperty
calls, pass "special" instead of "poor", "std", or "pro".

The "anim_group" property expects as argument the animation group ID in
the form of an integer. The wiki page on setWeaponProperty should
be updated with additional information, since the ID's are only visible
in code.

To make a ped use the "special" skill level, assign a stat value of
5000 to the weapon stat. This reflects the same value used by GTA:SA
for the cops' pistol animation (the only place where this skill level
is used by the base game).

The Lua function setPedStat has been updated to differentiate between
weapon and non-weapon stats, notably for value checking (maximum is
either 5000 or 1000, respectively).

The weapon property sync structure was changed to include ALL weapon
properties, not just the one's that can be set via setWeaponProperty.
This is due to the fact that GTA:SA seems to clear the "special" skill
level entries when joining the server, which also includes indices,
slot numbers, etc. There was no problem before (with just the "poor",
"std" and "pro" levels) since these entries do not get cleared and the
server only had to override the relevant properties when joining.

By default, the "special" skill levels for all weapons but the pistol
inherit their properties from their "pro" counterparts. The pistol uses
the "cop_colt" configuration provided by the game's "weapon.dat" file.
@DeValdi DeValdi requested a review from a team as a code owner February 6, 2026 02:10
@FileEX FileEX added the enhancement New feature or request label Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "anim_group" to setWeaponProperty()

2 participants