Raised This Month: $ Target: $400
 0% 

[TF2] Visible Weapons Natives (broken)(v1.2, 2/24/2011)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author
FlaminSarge
Veteran Member
Join Date: Jul 2010
Plugin ID:
2131
Plugin Version:
1.2
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Natives to manage attachable weapon models when weapons are invisible (such as through giveweapon or randomizer)
    Unapprover:
    Reason for Unapproving:
    Valve...
    Old 12-18-2010 , 17:40   [TF2] Visible Weapons Natives (broken)(v1.2, 2/24/2011)
    Reply With Quote #1

    ATTACHABLES IS BROKEN THEREFORE THIS IS BROKEN
    SO!
    People requested for Randomizer to have visible weapons.
    I said "nowai, needs attachables, and I'm not including attachables in randomizer as a requirement!"
    So then I found out how to make it optional.
    So here.
    Natives for giving weapons to clients.
    What it does is, all plugins that use this can add the native VisWep_GiveWeapon(client, slot, model)
    after each time they give a weapon.
    It will automatically organize each slot's attachable entity, as well as invis/vis the slots depending on OnWeaponSwitch from SDKHooks.

    So, requires SDKHooks and Attachables.
    http://forums.alliedmods.net/showthread.php?t=106748
    https://forums.alliedmods.net/showthread.php?t=126577

    Cvar:
    visibleweapons_version (default 1.2)

    Native:
    PHP Code:
    /**
     * Sets up an attachable for a slot.
     *
     * @param client        Client Index. Does an alive/in-game/valid check in the function
     * @param slot        The weapon slot for the attachable.
     * @param model        The model you want to attach, if custom. Otherwise, put the item index here, like "169".
     * @noreturn
     */
    native VisWep_GiveWeapon(clientslot, const String:model[]); 
    If you wanna make it optional, add a new bool near the top (thanks to _1Swatty for this stuff)
    new bool:visibleweapons = false;

    OnPluginStart, do this:
    visibleweapons = LibraryExists("visweps");

    And then, OnLibraryAdded:
    if (StrEqual(name, "visweps")) visibleweapons = true;

    OnLibraryRemoved:
    if (StrEqual(name, "visweps")) visibleweapons = false;

    Then put the if (visibleweapons) in front of each time you use VisWep_GiveWeapon so it skips over it if visibleweapons is not on the server.

    NOTE: You CAN put in a number for the model name, and it will attempt to find the model associated with that item index. E.g. 312 = brass beast. Will auto-set the brass beast model.

    Look at http://forums.alliedmods.net/showthread.php?t=141962 and https://forums.alliedmods.net/showthread.php?t=139069
    for examples.

    TL;DR if you're a developer and you put this native in a giveweapon plugin at each time the weapon is given, it will make the weapon visible and auto-invis it if the weapon is not out.

    Also does the banner backpacks, and stuff.

    To the people that are here for Randomizer and Give Weapon: just install the plugin, and SDKHooks and Attachables.
    ALSO to such persons, models for the Rebel's Curse and Khopesh Climber.

    Credit to Mecha the Slag for some/most of the basic code.

    Changelog

    Code:
    2/24/2011(v1.2)
    *Added wearable weapon support (send it as slot 6 to make it a wearable instead of a normal weapon)
    *Added worldmodels for index 142(gunslinger) and index 5/195(fists)
    *Razorback and Danger Shield models (requires latest attachables)
    *Rift weapons now get models (but not their actual models, yet)
    *Flamethrower fixed
    *Upgradeable weapons (index used for renamed) now have models
    *Some changes to the hiding function to hide better on disguise, etc. Also, dead ringer hide. But I'm not sure if I'm doing it right.
    
    01/07/2011(v1.1)
    *Fixed function with custom model usage (forgot an strcopy somewhere in there)
    *Uh... Added a model for Ludmila from GiveWeapon/Randomizer: it's a sasha with the natascha strap on the side. So it's different from both.
    *Some minor changes in capitalization, cleanup as suggested by Kevin_b_er.
    *In the .inc file, added #if !defined REQUIRE_PLUGIN over the SetNTVOptional line (#endif after). Just because that seemed a convention.
    
    12/18/2010 (v1.0)
    *First Release
    ANOTHER NOTE: If you are running Sidewinder or TFDodgeball, this will not work. Why? Both use the CEntity framework for their homing, which interferes with attachables in some way, making the attachables invisible again. Sadface. Asherkin said he is going to work on it some time. In this thread. Somewhere.
    Attached Files
    File Type: smx visibleweapons.smx (12.6 KB, 1156 views)
    File Type: inc visweps.inc (753 Bytes, 1185 views)
    File Type: sp Get Plugin or Get Source (visibleweapons.sp - 834 views - 24.6 KB)
    __________________
    Bread EOTL GunMettle Invasion Jungle Inferno 64-bit 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.

    Last edited by FlaminSarge; 10-25-2011 at 20:01.
    FlaminSarge is offline
     



    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 21:23.


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