Results 1 to 6 of 6

Thread: How Do You Check What Weapons A Person Has?

  1. #1

    Default How Do You Check What Weapons A Person Has?

    Is there a way to check and see if a player at least has a sniper rifle? I don't care if it's holstered or upholstered, I just want to know if a player has kar98 or Springfield on them. I'll write the rest. Anything like local.player.weapons ?

    I haven't modded in a while, so just bare with me please.

    All help is appreciated.
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  2. #2
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,269

    Default

    Hi

    local.player.inventory results in an array of what the player is holding , including weapons and items ie binoculars
    http://www.x-null.net/forums/showthr...-Documentation << 2nd last command

    so local.player.inventory[0] should be primary weapon, or maybe [1] , test it out.
    i was using it my morphing script to give players back the weapons they had before they were morphed ,

    I used
    Code:
        for(local.i = 0; local.i <= local.player.inventory.size; local.i++)
        {
            if(local.player.inventory[local.i] != NIL)
            level.inv[local.player.entnum][local.i] = local.player.inventory[local.i].model
            
            waitframe
            
        }
    To save the players inventory to a level variable.

    BUT atm it when accessing it using a LINUX server it crashes, been a bug for awhile , dont no if its been fixed , but worked fine on a windows server , so idk

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  3. #3

    Default

    Yep, worked fine for me in Windows. But, it does crash in Linux:

    Code:
    cache models/items/binoculars.tik
    Got signal 11 - Segmentation fault, faulty address is 0x2fa88
    Crash Recover Attempt will take place!
    Execution path:
     --> ./fgameded.so(PL_Inventory+0x1c5) [0xf2841581]
     --> ./fgamededmohaa.so(_ZN8ScriptVM7ExecuteEP14ScriptVariablei9const_str+0x242b) [0xf24aae9b]
     --> ./fgamededmohaa.so(_ZN12ScriptMaster14ExecuteRunningEv+0xd9) [0xf248e7c9]
     --> ./fgamededmohaa.so(G_RunFrame+0x258) [0xf2541078]
     --> ./fgameded.so(G_RunFrame+0x7d8) [0xf28453bc]
     --> ./mohaa_lnxded() [0x808d7ab]
     --> ./mohaa_lnxded() [0x8067486]
     --> ./mohaa_lnxded() [0x809726e]
     --> /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0xf74dc935]
    Dang it. I could really use this. Wish it would get fixed.

    Is there a way to get the current weapon model that the player is currently holding / what does it return when no weapons are active?
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  4. #4
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Use getactiveweap to get the weapon entity and then check its model.

    To know if the inventory is empty or if the player has an inventory at all use
    Code:
    .inventory.size <= 0
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  5. #5

    Default

    Woot, that worked. Thanks!
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  6. #6
    Developer Todesengel's Avatar
    Join Date
    Dec 2013
    Location
    St. Louis, Missouri, USA
    Posts
    276

    Default

    Quote Originally Posted by Purple Elephant1au View Post
    Hi

    local.player.inventory results in an array of what the player is holding , including weapons and items ie binoculars
    http://www.x-null.net/forums/showthr...-Documentation << 2nd last command

    so local.player.inventory[0] should be primary weapon, or maybe [1] , test it out.
    i was using it my morphing script to give players back the weapons they had before they were morphed ,

    I used
    Code:
        for(local.i = 0; local.i <= local.player.inventory.size; local.i++)
        {
            if(local.player.inventory[local.i] != NIL)
            level.inv[local.player.entnum][local.i] = local.player.inventory[local.i].model
            
            waitframe
            
        }
    To save the players inventory to a level variable.

    BUT atm it when accessing it using a LINUX server it crashes, been a bug for awhile , dont no if its been fixed , but worked fine on a windows server , so idk
    And I can confirm that local.player.inventory is in fact, still broken on *nix. Immediate server crash....

Posting Permissions

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