Thread: Weapon values

Results 1 to 6 of 6
  1. #1
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,599

    Weapon values

    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:

    Code:
    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:

    Code:
    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.
    Love,
    w00tguy

  2. #2
    Donated 15NS$ for Sven's Holiday at the Bahamas Puchi's Avatar  
    Artist
    Join Date
    Nov 2002
    Location
    Akihabara, Bochum or Sailune
    Posts
    5,618

    Re: Weapon values

    This is nice.
    Do it with passion, or not at all.
    Do not say everything you know. Know everything you say.
    [ MarySP ][ nacl-h2o ][ The next SC Version ♥♥♥♥ing pwns! ][Puchis Maps ]

  3. #3
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: Weapon values

    This won't work in 5.0, but Angelscript provides a proper interface.

  4. #4
    Registered User
    Join Date
    Nov 2014
    Location
    around.
    Posts
    393

    Re: Weapon values

    Good job W00tguy! I have in mind a nasty surprise for rogue persons who abuse certain plugins to give themselves vast arsenals..

  5. #5
    Banned Solokiller's Avatar
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    3,314

    Re: Weapon values

    5.0 is being released today and you want to use a soon to be non-functional keyvalue to prevent cheating? Good luck :P

  6. #6
    Registered User
    Join Date
    Nov 2014
    Location
    around.
    Posts
    393

    Re: Weapon values

    Yes! :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •