AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [TF2] Visible Weapons Natives (broken)(v1.2, 2/24/2011) (https://forums.alliedmods.net/showthread.php?t=145664)

FlaminSarge 12-18-2010 17:40

[TF2] Visible Weapons Natives (broken)(v1.2, 2/24/2011)
 
11 Attachment(s)
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.

EHG 12-18-2010 17:54

Re: [TF2] Visible Weapons Natives
 
Good job! :D

ummja 12-18-2010 18:45

Re: [TF2] Visible Weapons Natives
 
Hey Sarge did you by any chance install this on our server?

FlaminSarge 12-18-2010 19:03

Re: [TF2] Visible Weapons Natives
 
Not yet. You do it.

ummja 12-18-2010 19:14

Re: [TF2] Visible Weapons Natives
 
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.

satanchia 12-19-2010 05:12

Re: [TF2] Visible Weapons Natives
 
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?

FlaminSarge 12-19-2010 17:20

Re: [TF2] Visible Weapons Natives
 
Quote:

Originally Posted by satanchia (Post 1374404)
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.

satanchia 12-19-2010 17:27

Re: [TF2] Visible Weapons Natives
 
Hahahah Yeah, I figured as much. Still had to ask because your earliest versions of giveweapon had visible golden wrenches :twisted:

FlaminSarge 12-19-2010 17:31

Re: [TF2] Visible Weapons Natives
 
... o.o since when?

Regis 12-19-2010 18:06

Re: [TF2] Visible Weapons Natives
 
Quote:

Originally Posted by FlaminSarge (Post 1374891)
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.


All times are GMT -4. The time now is 21:23.

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