Raised This Month: $51 Target: $400
 12% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
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, 1146 views)
    File Type: inc visweps.inc (753 Bytes, 1177 views)
    File Type: sp Get Plugin or Get Source (visibleweapons.sp - 823 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
    EHG
    Senior Member
    Join Date: May 2009
    Location: 127.0.0.1
    Old 12-18-2010 , 17:54   Re: [TF2] Visible Weapons Natives
    Reply With Quote #2

    Good job!
    EHG is offline
    ummja
    Senior Member
    Join Date: Sep 2010
    Old 12-18-2010 , 18:45   Re: [TF2] Visible Weapons Natives
    Reply With Quote #3

    Hey Sarge did you by any chance install this on our server?
    ummja is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 12-18-2010 , 19:03   Re: [TF2] Visible Weapons Natives
    Reply With Quote #4

    Not yet. You do it.
    __________________
    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.
    FlaminSarge is offline
    ummja
    Senior Member
    Join Date: Sep 2010
    Old 12-18-2010 , 19:14   Re: [TF2] Visible Weapons Natives
    Reply With Quote #5

    Ok will do soon.

    Parents pissed at me so I have no steam access for a bit.

    Server rent up soon. I'll work on getting those things in check.
    ummja is offline
    satanchia
    Junior Member
    Join Date: Nov 2009
    Old 12-19-2010 , 05:12   Re: [TF2] Visible Weapons Natives
    Reply With Quote #6

    I have noticed using this that the golden wrench doesn't look golden to anyone but yourself, with your randomizer/giveweapon plugins. Is it possible to fix this?
    satanchia is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 12-19-2010 , 17:20   Re: [TF2] Visible Weapons Natives
    Reply With Quote #7

    Quote:
    Originally Posted by satanchia View Post
    I have noticed using this that the golden wrench doesn't look golden to anyone but yourself, with your randomizer/giveweapon plugins. Is it possible to fix this?
    That's intentional.
    1) Do you have ANY idea what kinda sh**storm would happen with Valve if I made golden wrenches ACTUALLY GOLDEN? The whole reason they made stuff invisible was so people couldn't put exclusive items on at will. So it will stay a normal wrench.
    2) It's a material override, which I am not going to figure out.

    Don't try to do it. Valve will eat you.
    So will voogru.
    I'd be scared of voogru more.
    __________________
    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.
    FlaminSarge is offline
    satanchia
    Junior Member
    Join Date: Nov 2009
    Old 12-19-2010 , 17:27   Re: [TF2] Visible Weapons Natives
    Reply With Quote #8

    Hahahah Yeah, I figured as much. Still had to ask because your earliest versions of giveweapon had visible golden wrenches
    satanchia is offline
    FlaminSarge
    Veteran Member
    Join Date: Jul 2010
    Old 12-19-2010 , 17:31   Re: [TF2] Visible Weapons Natives
    Reply With Quote #9

    ... o.o since when?
    __________________
    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.
    FlaminSarge is offline
    Regis
    Member
    Join Date: Sep 2009
    Old 12-19-2010 , 18:06   Re: [TF2] Visible Weapons Natives
    Reply With Quote #10

    Quote:
    Originally Posted by FlaminSarge View Post
    That's intentional.
    1) Do you have ANY idea what kinda sh**storm would happen with Valve if I made golden wrenches ACTUALLY GOLDEN? The whole reason they made stuff invisible was so people couldn't put exclusive items on at will. So it will stay a normal wrench.
    2) It's a material override, which I am not going to figure out.

    Don't try to do it. Valve will eat you.
    So will voogru.
    I'd be scared of voogru more.
    Such limitations make me wish EHG or mecha would tell me the workaround they use on their servers.
    Regis is offline
    Reply



    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 02:24.


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