Raised This Month: $134 Target: $400
 33% 

[DEV] *DEAD* TF2ItemsInfo v1.8.17.7 (21 Nov 2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Leonardo
Veteran Member
Join Date: Feb 2010
Location: Soviet Union
Plugin ID:
2907
Plugin Version:
1.8.17.7-20131121
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    347 
    Plugin Description:
    Obtaining item info from items_game.txt
    Unapprover:
    Reason for Unapproving:
    No longer supported by author
    Old 04-15-2012 , 07:02   [DEV] *DEAD* TF2ItemsInfo v1.8.17.7 (21 Nov 2013)
    Reply With Quote #1

    Announcement!
    Since I have no free time, also due to lack of interest, I cannot support this plugin anymore. I hope someone would make a mem-hacking version.

    MEMORY LEAK FIX
    https://forums.alliedmods.net/showpost.php?p=2177564


    ============================================= =============================================

    What is it?
    List of natives that could be useful for plugin devs.
    What uses this?
    * [TF2Items] Bot Weapon Randomizer
    * [TF2Items] Give Weapon
    * Many private plugins
    Who is credit to team?
    * Mecha The Slag - original idea;
    * FlaminSarge - bug fixes,
    * 11530 - bug reports.
    How to install?
    * Download files from Links section (below)
    * Put tf2itemsinfo.smx in /addons/sourcemod/plugins/
    * Put tf2itemsinfo.txt in /addons/sourcemod/data/
    * Put tf2itemsinfo.sp in /addons/sourcemod/scripting/
    * Put tf2itemsinfo.inc in /addons/sourcemod/scripting/includes/
    Optional:
    Updater plugin.
    How to configure?
    Is not possible.
    Known issues?
    1/ Memory leak error. Temporary fix - manually load plugin back. Fixed!
    2/ High memory usage (22MiB). Fixed (?).
    ToDo list:
    * Add function that returns a KeyValues per item;
    * Add function that returns item model;
    * Add function that returns item styles.
    CVars & CMDs:
    PHP Code:
    // variables
    sm_tf2ii_version // version
    sm_tf2ii_logs 1 // Enable/disable logs
    sm_tf2ii_db "" // DB name (from databases.cfg)
    sm_tf2ii_fix01 0 // Fix items with 'string' attributes
    sm_tf2ii_updater 1 // enable/disable autoupdate
    // commands
    sm_tf2ii_refresh // rescan items_game.txt
    sm_tf2ii_reload // same as above
    sm_si <name> [pagenum// find items ids by name
    sm_fi <name> [pagenum// same as above
    sm_sic <classname> [pagenum// find items ids by classname
    sm_fic <classname> [pagenum// same as above
    sm_ii <id> [extra// print item info (extra value - anything except 0)
    sm_pi [id] [extra// print item info (extra value - anything except 0)
    sm_sa <id|name> [pagenum// find attributes ids by id or name
    sm_fa <id|name> [pagenum// same as above
    sm_sac <classname> [pagenum// find attributes ids by classname
    sm_fac <classname> [pagenum// same as above 
    Natives, functions, etc:
    Basic data getting functions
    Validating functions
    Getting item data
    Getting attribute data
    Additional functions
    Other stuff
    Raw item/attribute data
    Getting lists
    Fowrards (events)
    Stock functions


    Changelogs:
    http://files.xpenia.org/sourcemod/tf2ii/

    Downloads:
    Full pack: tf2itemsinfo.zip
    Binary: tf2itemsinfo.smx
    Source code: tf2itemsinfo.sp
    Includes: tf2itemsinfo.inc
    Data-file: tf2itemsinfo.txt
    __________________

    Last edited by Leonardo; 08-04-2014 at 02:13.
    Leonardo is offline
    Leonardo
    Veteran Member
    Join Date: Feb 2010
    Location: Soviet Union
    Old 04-15-2012 , 07:12   Re: [DEV] TF2 Item Info v1.2 (15.04.12)
    Reply With Quote #2

    Getting item information
    PHP Code:
    // example: Baseball Bat
    new iItemDefID 44;

    TF2II_IsValidItemIDiItemDefID );
    // result: true (item exists in items_game.txt)

    decl String:strName[32];
    TF2II_GetItemNameiItemDefIDstrNamesizeof(strName) );
    // result: "The Sandman"
    // note: name from items_game.txt and in-game name may be different

    decl String:strClassname[64];
    TF2II_GetItemClassiItemDefIDstrClassnamesizeof(strClassname) );
    // result: "tf_weapon_bat_wood"

    decl String:strSlot[16];
    TF2II_GetItemSlotNameiItemDefIDstrSlotsizeof(strSlot) );
    // result: "melee"

    TF2II_IsItemUsedByClassiItemDefIDTFClass_Scout );
    // result: true
    TF2II_IsItemUsedByClassiItemDefIDTFClass_Spy );
    // result: false

    // correct method to get item level
    new iMinLeveliMaxLeveliLevel;
    iMinLevel TF2II_GetItemMinLeveliItemDefID );
    // result: 15
    iMaxLevel TF2II_GetItemMaxLeveliItemDefID );
    // result: 15
    iLevel GetRandomIntiMinLeveliMaxLevel );
    // result: 15

    decl String:strQuality[16];
    TF2II_GetItemSlotNameiItemDefIDstrQualitysizeof(strQuality) );
    // result: "unique"
    new iQuality TF2II_GetQualityByNamestrQuality );
    // result: TF2ItemQuality_Unique (6)

    // getting attributes
    new iNumAttributesiAIndexes[16], Float:flAValues[16];
    iNumAttributes TF2II_GetItemNumAttributesiItemDefID );
    if( 
    iNumAttributes )
    {
        for( new 
    0< ( iNumAttributes 16 16 iNumAttributes ); a++ )
        {
            
    iAIndexes[a] = TF2II_GetItemAttributeIDiItemDefID);
            
    flAValues[a] = TF2II_GetItemAttributeValueiItemDefID);
        }
    }
    // result:
    // 38: 1.0 -- mod bat launches balls
    // 125: -15.0 -- max health additive penalty 
    Qualities
    PHP Code:
    decl String:strQualityName[16];
    TF2II_GetQualityName11strQualityNamesizeof(strQualityName) );
    // result: "strange"

    new iQualityNum TF2II_GetQualityByNamestrQualityName );
    // result: 11 
    Attributes
    PHP Code:
    new iAttributeIndex TF2II_GetAttributeIDByName"damage penalty" );
    // result: 1

    decl String:strAttributeName[32];
    TF2II_GetAttributeNameByID2strAttributeNamesizeof(strAttributeName) );
    // result: "damage bonus" 
    Holiday restriction
    PHP Code:
    // Mildly Disturbing Halloween Mask
    new iItemDefID 115;

    TF2II_ItemHolidayRestrictioniItemDefIDTFHoliday_Birthday );
    // result: false

    TF2II_ItemHolidayRestrictioniItemDefIDTFHoliday_Christmas );
    // result: false

    TF2II_ItemHolidayRestrictioniItemDefIDTFHoliday_Halloween );
    // result: true

    TF2II_ItemHolidayRestrictioniItemDefIDTFHoliday_FullMoon );
    // result: true

    TF2II_ItemHolidayRestrictioniItemDefIDTFHoliday_HalloweenOrFullMoon );
    // result: true 
    Equip regions
    PHP Code:
    // Spine-Chilling Skull
    new iItemDefID 287;

    decl String:strItemEquipRegion[16];
    new 
    Handle:hEquipReqions TF2II_GetItemEquipRegionsiItemDefID );

    GetArrayStringhItemEquipRegions0strItemEquipRegionsizeofstrItemEquipRegion ) );
    PrintToServer"Item %d - region 1 - '%s'"iItemDefIDstrItemEquipRegionstrItemEquipRegion );
    // result: Item 287 - reqgion 1 - 'hat'

    GetArrayStringhItemEquipRegions1strItemEquipRegionsizeofstrItemEquipRegion ) );
    PrintToServer"Item %d - region 2 - '%s'"iItemDefIDstrItemEquipRegionstrItemEquipRegion );
    // result: Item 287 - reqgion 2 - 'face'

    // also, conflicts

    TF2II_IsConflictRegions"arms""face" );
    // result: false

    TF2II_IsConflictRegions"whole_head""face" );
    // result: true 
    Getting items by conditions
    PHP Code:
    new Handle:hArray TF2II_FindItems();
    // result: array with ALL items (even with keys, crates, and gifts)

    TF2II_FindItems"tf_weapon_sword" );
    // get items with 'tf_weapon_sword' classname only

    TF2II_FindItemsIDsByCond_"melee" );
    // melee only

    new iUsedByClasses TF2II_CLASS_NONE// Used by nobody
    iUsedByClasses TF2II_CLASS_ENGINEER; -- Used by engineer only
    iUsedByClasses 
    TF2II_CLASS_DEMOMAN TF2II_CLASS_SOLDIER; -- Used by soldier and demoman only
    iUsedByClasses 
    TF2II_CLASS_ALL; -- Used by any class
    TF2II_FindItemsIDsByCond__iUsedByClasses );
    // get items that can be used by selected classes

    TF2II_FindItems___"paint_can" );
    // get paint cans only

    // you also can combine conditions

    TF2II_FindItemsIDsByCond_"melee"TF2II_CLASS_SOLDIER );
    // get soldier's melee weapons only 

    Last edited by Leonardo; 11-08-2012 at 13:33. Reason: typo fix
    Leonardo is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 04-15-2012 , 20:00   Re: [DEV] TF2 Item Info v1.3 (15.04.12)
    Reply With Quote #3

    Will be implemented in Randomizer/GiveWeapon soon! Awesome job! Better than ItemsGame manager.
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

    All plugins: Randomizer/GiveWeapon, ModelManager, etc.
    Post in plugin threads with questions.
    Steam is for playing games.
    You will be fed to javalia otherwise.
    Psyduck likes replays.
    FlaminSarge is offline
    Flacketeer
    New Member
    Join Date: Apr 2012
    Old 04-22-2012 , 22:51   Re: [DEV] TF2 Item Info v1.5 (19.04.12)
    Reply With Quote #4

    Hello, I've been getting a problem with the Bot Weapon Randomizer Mod. I noticed someone in the thread (which you asked to discuss it here instead) had the same problem were in the bots had only stock weapons and my console was spammed with this message:

    Code:
    L 04/22/2012 - 20:42:38: [SM] Native "TF2Items_SetQuality" reported: Quality out
     of bounds: 13 [-1 ... 11]
    L 04/22/2012 - 20:42:38: [SM] Displaying call stack trace for plugin "tf2ibwr.sm
    x":
    L 04/22/2012 - 20:42:38: [SM]   [0]  Line 386, E:\_DedicatedServers\TF2\orangebo
    x\tf\addons\sourcemod\scripting\tf2ibwr.sp::Timer_HookedEvent()
    and once in awhile I'd get this:

    Code:
    L 04/22/2012 - 20:45:35: [SM] Native "TF2Items_SetQuality" reported: Quality out
     of bounds: 13 [-1 ... 11]
    L 04/22/2012 - 20:45:35: [SM] Displaying call stack trace for plugin "tf2ibwr.sm
    x":
    L 04/22/2012 - 20:45:35: [SM]   [0]  Line 386, E:\_DedicatedServers\TF2\orangebo
    x\tf\addons\sourcemod\scripting\tf2ibwr.sp::Timer_HookedEvent()
    material models/player/items/all_class/all_halo has a normal map and $basealphae
    nvmapmask.  Must use $normalmapalphaenvmapmask to get specular.
    and these:

    Code:
    L 04/22/2012 - 20:41:26: [SM] Native "TF2Items_SetQuality" reported: Quality out
     of bounds: 13 [-1 ... 11]
    L 04/22/2012 - 20:41:26: [SM] Displaying call stack trace for plugin "tf2ibwr.sm
    x":
    L 04/22/2012 - 20:41:26: [SM]   [0]  Line 386, E:\_DedicatedServers\TF2\orangebo
    x\tf\addons\sourcemod\scripting\tf2ibwr.sp::Timer_HookedEvent()
    DataTable warning: env_sprite: Out-of-range value (1.000000) in SendPropFloat 'm
    _vecNormal', clamping.
    I tried typing sm plugins info tf2itemsinfo and got this:

    Code:
    sm plugins info tf2itemsinfo
      Filename: tf2itemsinfo.smx
      Title: [DEV] TF2 Items Info (Obtaining item info)
      Author: Leonardo
      Version: 1.5
      URL: http://xpenia.org/
      Status: running
      Reloads: Map Change if Updated
      Timestamp: 04/22/2012 23:55:43
    Any help in solving this issue would be great. I think this is a wonderful plugin and would love to enjoy it to its fullest extent.
    Flacketeer is offline
    Leonardo
    Veteran Member
    Join Date: Feb 2010
    Location: Soviet Union
    Old 04-23-2012 , 04:18   Re: [DEV] TF2 Item Info v1.5 (19.04.12)
    Reply With Quote #5

    nope. this error goes here
    __________________
    Leonardo is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 05-17-2012 , 13:00   Re: [DEV] TF2 Item Info v1.8 (15.05.12)
    Reply With Quote #6

    Is there any particular reason that bUsedByClass doesn't use their TFClassType values as its indexes?
    __________________
    Am I back? Well, we'll see.
    Powerlord is offline
    Leonardo
    Veteran Member
    Join Date: Feb 2010
    Location: Soviet Union
    Old 05-17-2012 , 14:10   Re: [DEV] TF2 Item Info v1.8 (15.05.12)
    Reply With Quote #7

    TFClassType begins from 1
    'unknown' class isn't allowed here
    k?
    Leonardo is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 05-17-2012 , 14:13   Re: [DEV] TF2 Item Info v1.8 (15.05.12)
    Reply With Quote #8

    Quote:
    Originally Posted by Leonardo View Post
    TFClassType begins from 1
    'unknown' class isn't allowed here
    k?
    But you still have a tenth ("Jesus") class as one of the slots, which would neatly fill the empty spot.

    Besides which, arrays with the first item empty is fairly common in arrays that use player indexes.
    __________________
    Am I back? Well, we'll see.
    Powerlord is offline
    Leonardo
    Veteran Member
    Join Date: Feb 2010
    Location: Soviet Union
    Old 05-17-2012 , 14:24   Re: [DEV] TF2 Item Info v1.8 (15.05.12)
    Reply With Quote #9

    I'll fix it if you tell me how to get size of an enum~
    Leonardo is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 05-17-2012 , 14:27   Re: [DEV] TF2 Item Info v1.8 (15.05.12)
    Reply With Quote #10

    Quote:
    Originally Posted by Leonardo View Post
    I'll fix it if you tell me how to get size of an enum~
    Quoting asherkin from another thread:

    Quote:
    Originally Posted by asherkin View Post
    An enum = a list of named values, i.e.
    Code:
    enum AnEnum
    { 
        AnEnum_FirstValue,
        AnEnum_SecondValue,
        AnEnum_ThirdValue,
        AnEnum_FourthValue,
        AnEnum_FifthValue,
    };
    Now, if you print the values of each, you get:
    AnEnum_FirstValue = 0
    AnEnum_SecondValue = 1
    AnEnum_ThirdValue = 2
    AnEnum_FourthValue = 3
    AnEnum_FifthValue = 4

    This works with arrays because the name of the enum evaluates to the next number that would be assigned to an entry in it (AnEnum = 5),
    so if you do
    Code:
    new AnArray[AnEnum];
    you get an array with 5 members
    In fact, this should work regardless because even sparse enums (with skipped values) will have a large enough array to store all values if you use the enum name. I actually just learned this today...
    __________________
    Am I back? Well, we'll see.
    Powerlord is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 12:33.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode