Raised This Month: $ Target: $400
 0% 

[L4D2] Weapon, Survivor, Gamemode identification includes (Trie)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ProdigySim
SourceMod Plugin Approver
Join Date: Feb 2010
Old 06-21-2011 , 13:11   [L4D2] Weapon, Survivor, Gamemode identification includes (Trie)
Reply With Quote #1

Description
There are a lot of plugins that don't take full advantage of the wonderful ADT_Trie Sourcemod provides us. I've made three includes that will help L4D2 plugin makers take advantage of the efficiency of Tries. These will also help people simplify identification of survivors, weapons, and gamemodes.

survivors.inc
Very simply, survivors.inc allows you to identify survivors quicky based on their player model. It also contains string arrays that will let you lookup the character names and models from a character ID.

weapons.inc
This will help you identify weapons quickly based on their classname. It works on weapon_spawn, weapon_X_spawn, and weapon_X style entities. As far as I know, it can identify any weapon entity.

Also included is a function to "convert" a weapon spawn. If you want to, say, convert all SMGs into M60s, it is very simple. You can also lookup weapon names and models from the arrays in the .inc.

gamemodes.inc
This will help you identify gamemodes and base gamemodes. Right now, the content is static, but I may eventually switch it to read from the live gamemodes.txt on the system. Basically, if you're writing a plugin that will behave differently on different gamemodes, then this is very useful. Instead of doing 20+ string compares in a row, you can simply do GameModeStringToId(), and maybe follow up with GetBaseGameMode(), and determine your plugin behavior from there.

Headers
The .incs are short and well commented, so I'm not sure there's use to put these here. I'll consider it later.

Examples
I'll put up more of these later, but for now, here's a Test Plugin I've been using to test out these .incs:
https://bitbucket.org/ProdigySim/mis.../testplugin.sp
L4D2 Double-standup fix

Installation/Usage
Place these .incs in your sourcemod/scripting/include/ folder and then include them in your project with
#include <survivors>
#include <weapons>
#include <gamemodes>

You can also place them in a local directory and use #include "survivors.inc" if you want.

tl; dr - If you need to identify gamemodes, weapons, or survivors in your plugins, you should use these .incs or something similar!
Attached Files
File Type: inc gamemodes.inc (4.5 KB, 358 views)
File Type: inc survivors.inc (2.6 KB, 463 views)
File Type: inc weapons.inc (10.1 KB, 423 views)

Last edited by ProdigySim; 06-22-2011 at 13:21.
ProdigySim 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 16:24.


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