PDA

View Full Version : Weapon values



w00tguy123
05-07-2015, 08:22 PM
If you read a player's "weapons" keyvalue, you get back a bitfield (a number interpreted as a list of flags/booleans) for the player's current arsenal. Here's the value for each weapon:



crowbar : 2
9mmhandgun : 4
357 : 8
9mmAR : 16
crossbow : 64
shotgun : 128
rpg : 256
gauss : 512
egon : 1024
hornet : 2048
handgrenade : 4096
tripmine : 8192
satchel : 16384
snark : 32768
uzi : 131072
uziakimbo : 196608
medkit : 262144
pipewrench : 1048576
minigun : 2097152
grapple : 4194304
sniper : 8388608
m249 : 16777216
m16 : 33554432
sporelauncher : 67108864
eagle : 134217728
shockrifle : 268435456

no weapons : -2147483640 (not a flag, just the exact value of "weapons" in this state)

So, if a player's "weapons" keyvalue is 18, then you know they have the 9mmAR and the crowbar (16 + 2).

You can test specific weapons using the & operator with trigger_condition. For example, this is how you you would set up a trigger_condition to check if a player has the shotgun:



trigger_condition

Name: check_shotgun
Monitored entity: guy
Monitored key: weapons
Compare-value: 128
Comparator: & (Logical AND)
'true'-case: guy_has_shotgun
'false'-case: guy_has_no_shotgun


I'm posting this mostly because I don't think these weapon values are available anywhere and it took some time to figure out what they all are.

Puchi
05-07-2015, 09:17 PM
This is nice.

Solokiller
06-07-2015, 01:24 AM
This won't work in 5.0, but Angelscript provides a proper interface.

BlueSpark
22-01-2016, 02:06 PM
Good job W00tguy! I have in mind a nasty surprise for rogue persons who abuse certain plugins to give themselves vast arsenals.. :D

Solokiller
22-01-2016, 02:37 PM
5.0 is being released today and you want to use a soon to be non-functional keyvalue to prevent cheating? Good luck :P

BlueSpark
22-01-2016, 03:14 PM
Yes! :P