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

TF2 Stocks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
naris
AlliedModders Donor
Join Date: Dec 2006
Old 05-08-2010 , 14:42   TF2 Stocks
Reply With Quote #1

Here are several stocks I use for TF2 for various things. Included here are:

○ tf2_ammo
PHP Code:
enum TFAmmoTypes
stock TF2_GetAmmoAmount
(client,TFAmmoTypes:type=Primary)
stock TF2_SetAmmoAmount(clientammo,TFAmmoTypes:type=Primary)
stock TF2_GetMetalAmount(client)
stock TF2_GetMetalAmount(client


○ tf2_build
PHP Code:
stock BuildSentry(hBuilder, const Float:fOrigin[3], const Float:fAngle[3], iLevel=1,
                  
bool:bDisabled=falsebool:bMini=falsebool:bShielded=false,
                  
iHealth=-1iMaxHealth=-1iShells=-1iRockets=-1,
                  
Float:flPercentage=1.0)

stock BuildDispenser(hBuilder, const Float:fOrigin[3], const Float:fAngle[3], iLevel=1,
                     
bool:iDisabled=falseiHealth=-1iMaxHealth=-1iMetal=-1,
                     
Float:flPercentage=1.0TFExtObject:type=TFExtObject_Dispenser)

stock BuildTeleporterEntry(hBuilder, const Float:fOrigin[3], const Float:fAngle[3],
                           
iLevel=1bool:iDisabled=falseiHealth=-1iMaxHealth=-1,
                           
Float:flPercentage=1.0)

stock BuildTeleporterExit(hBuilder, const Float:fOrigin[3], const Float:fAngle[3],
                          
iLevel=1bool:iDisabled=falseiHealth=-1iMaxHealth=-1,
                          
Float:flPercentage=1.0


tf2_cloak tf2_meter
PHP Code:
stock Float:TF2_GetCloakMeter(client)
stock TF2_SetCloakMeter(client,Float:cloakMeter)
stock Float:TF2_GetChargeMeter(client)
stock TF2_SetChargeMeter(client,Float:chargeMeter)
stock Float:TF2_GetRageMeter(client)
stock TF2_SetRageMeter(client,Float:rageMeter)
stock Float:TF2_GetHypeMeter(client)
stock TF2_SetHypeMeter(client,Float:hypeMeter)
stock Float:TF2_GetEnergyDrinkMeter(client)
stock TF2_SetEnergyDrinkMeter(client,Float:energyDrinkMeter


○ tf2_flag
PHP Code:
stock bool:TF2_HasTheFlag(client)
stock TF2_GetFlagCarrier(team


○ tf2_game_text: Display text box message similar to domination messages
PHP Code:
stock tf2_game_text(const String:message[], const String:icon[]=""


○ tf2_objects
PHP Code:
enum TFExtObjectType
{
    
TFExtObject_Unknown = -1,
    
TFExtObject_CartDispenser 0,
    
TFExtObject_Dispenser 0,
    
TFExtObject_Teleporter 1,
    
TFExtObject_Sentry 2,
    
TFExtObject_Sapper 3,
    
TFExtObject_TeleporterEntry,
    
TFExtObject_TeleporterExit,
    
TFExtObject_MiniSentry,
    
TFExtObject_Amplifier,
    
TFExtObject_RepairNode,
    
TFExtObject_UpgradeStation
};

stock const String:TF2_ObjectClassNames[TFExtObjectType][]
stock const String:TF2_ObjectNames[TFExtObjectType][]
stock TF2_ObjectModes[TFExtObjectType]

// Sentry Ammo for each Level
stock const TF2_MaxSentryShells[]
stock const TF2_MaxSentryRockets[]
stock const TF2_SentryHealth[]

stock const TF2_MaxUpgradeMetal
stock 
const TF2_MaxDispenserMetal

stock TFExtObjectType
:TF2_GetExtObjectType(entitybool:specific=false


○ tf2_optional: Automatically makes tf2 natives optional when REQUIRE_EXTENSIONS is not defined
PHP Code:
public __ext_tf2_SetNTVOptional


○ tf2_player
PHP Code:
stock const String:TF2_TeamName[TFTeam][]
stock const String:TF2_ClassName[TFClassType][]
stock const TF2_ClassHealth[TFClassType]
stock const Float:TF2_ClassSpeed[TFClassType]

const 
String:TF2_GetClassName(TFClassType:class)
TF2_GetClassHealth(TFClassType:class)
Float:TF2_GetClassSpeed(TFClassType:class)

stock TF2_GetNumHealers(client)
stock Float:TF2_GetPlayerSpeed(client)
stock TF2_GetPlayerMaxHealth(client)

bool:TF2_Is<condition>(pcond)
bool:TF2_IsPlayer<condition>(client)

stock TF2_GetPlayerConditionLowBits(client)
stock TF2_GetPlayerConditionHighBits(client


○ tf2_uber
PHP Code:
stock TF2_IsUberCharge(client)
stock Float:TF2_GetUberLevel(client)
stock TF2_SetUberLevel(clientFloat:uberlevel)

// Ex functions validate player is a medic with a medigun first
stock TF2_ExIsUberCharge(client)
stock Float:TF2_ExGetUberLevel(client
stock bool:TF2_ExSetUberLevel(clientFloat:uberlevel)
stock TF2_GetNumHealers(client)
stock TF2_GetHealingTarget(client, &bool:ubered false


○ weapons
PHP Code:
#define MAX_SLOTS 48
stock GetActiveWeapon(clientbool:validate=true)
stock GetCurrentWeaponClass(clientString:name[], maxlength)
stock GetCurrentWeaponEdictClass(clientString:name[], maxlength)
stock GetClip(weapon)
stock SetClip(weaponamount)
stock GetAmmoType(weapon)

stock SetNextAttack(clientFloat:duration=0.0

Attached Files
File Type: inc tf2_ammo.inc (916 Bytes, 955 views)
File Type: inc tf2_build.inc (17.6 KB, 957 views)
File Type: inc tf2_flag.inc (895 Bytes, 1160 views)
File Type: inc tf2_game_text.inc (1.3 KB, 624 views)
File Type: inc tf2_objects.inc (3.4 KB, 657 views)
File Type: inc tf2_player.inc (16.2 KB, 689 views)
File Type: inc tf2_uber.inc (3.3 KB, 852 views)
File Type: inc tf2_meter.inc (1.5 KB, 946 views)
File Type: inc tf2_giveweapon.inc (6.5 KB, 906 views)
File Type: inc weapons.inc (2.2 KB, 749 views)

Last edited by naris; 08-29-2012 at 22:49.
naris is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 05-08-2010 , 15:14   Re: TF2 Stocks
Reply With Quote #2

This is awesomely useful but could you combine all the includes into one? Or make a zip folder?
noodleboy347 is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 05-08-2010 , 19:30   Re: TF2 Stocks
Reply With Quote #3

Here you go, all in 1 zip.
Attached Files
File Type: zip tf2_stocks.zip (7.4 KB, 980 views)
naris is offline
alinayg
Senior Member
Join Date: Apr 2009
Location: USA, RI
Old 05-14-2010 , 20:15   Re: TF2 Stocks
Reply With Quote #4

Hall hail the master of Warcraft Mod for TF2. Would love to ask you some questions some time, thanks for the awesome includes.
__________________
alinayg is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 05-15-2010 , 18:22   Re: TF2 Stocks
Reply With Quote #5

Quote:
Originally Posted by alinayg View Post
Hall hail
Do a hall hail
noodleboy347 is offline
ntp
Member
Join Date: May 2012
Old 08-22-2012 , 04:04   Re: TF2 Stocks
Reply With Quote #6

is there an updated version of this?
ntp is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-22-2012 , 10:43   Re: TF2 Stocks
Reply With Quote #7

Quote:
Originally Posted by ntp View Post
is there an updated version of this?
Which function specifically are you looking for?

  • tf2_ammo may still work, but Valve introduced energy weapons since then, so this likely needs an update.
  • tf2_build... I haven't had a chance to check this one out. However, SourceMod is currently having issues with entity creation, so it's likely broken right now until that issue is fixed even if the method it's using still works.
  • tf2_cloak should still be working fine.
  • tf2_flag should still be working fine.
  • tf2_game_text... I'm not sure about that one.
  • tf2_objects was moved into SourceMod itself under tf2_stocks, check its documentation for changes. You also need TF2_GetObjectMode to find out which end of a teleporter is which.
  • tf2_optional will cause issues with the TF2 extension, as it already contains the function named there.
  • tf2_player... see below.
  • tf2_uber should still be working fine.


tf2_player:

The following functions were moved into SourceMod itself:
  • enum TFPlayerCond is now enum TFCond in the tf2 extension (note: docs are slightly out of date; there are some new conditions not mentioned in there).
  • TF2_GetPlayerCond became TF2_GetPlayerConditionFlags, which got deprecated when TF2 changed how conditions worked.
  • TF2_Is<condition> and TF2_IsPlayer<condition> were unified into a single command: TF2_IsPlayerInCondition in tf2_stocks. This officially replaced TF2_GetPlayerConditionFlags.
  • In addition to the above, there are also TF2_AddCondition, TF2_RemoveCondition, TF2_OnConditionAdded callback, and TF2_OnConditionRemoved callback. All are in the tf2 extension.
The following were only slightly useful, as items modified things:
  • TF2_GetClassHealth - Scout, DemoMan, Heavy, Medic, and Spy all have items that change their starting health. You should GetEntProp(client, Prop_Send, "m_iMaxHealth") instead.
  • TF2_GetClassSpeed - This was pretty useless before due to Scout, Soldier, Pyro, DemoMan, and Heavy having items that adjusted movespeed. With the introduction of MvM, in which every class has the ability to buy move speed increases, it's even less useful. Use the code for TF2_GetPlayerSpeed below.
These were not carried over:
  • TF2_GetClassName - A shortcut for GetEntPropString(client, Prop_Data, "m_iClassname", classname, sizeof(classname))
  • TF2_GetPlayerSpeed - A shortcut for GetEntProp(client, Prop_Data, "m_flSpeed")
  • TF2_GetNumHealers - A shortcut for GetEntProp(client, Prop_Send, "m_nNumHealers")
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
ntp
Member
Join Date: May 2012
Old 08-23-2012 , 02:52   Re: TF2 Stocks
Reply With Quote #8

im trying to grab the stock health of the class that you were killed by.

lets say a soldier kills you, a soldier is 200hp stock. i want to grab that 200hp value and use it to determine if the class was low hp when he killed you.

essentially something like

if(attacker_class_stock-hp/5) >= attacker_current-hp
ntp is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-24-2012 , 08:33   Re: TF2 Stocks
Reply With Quote #9

I'd have to verify it, but I'm pretty sure the m_iMaxHealth Prop_Send netprop will give you a players max health...

PHP Code:
new maxHealth GetEntProp(clientProp_Send"m_iMaxHealth"); 
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-24-2012 at 08:34.
Powerlord is offline
NameUser
Senior Member
Join Date: Apr 2012
Location: Bay Area, California
Old 08-29-2012 , 10:10   Re: TF2 Stocks
Reply With Quote #10

This is some pretty useful stuff. Thanks for the stocks!
__________________
NameUser is offline
Send a message via Skype™ to NameUser
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 18:24.


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