PDA

View Full Version : [EXTENSION] Weapons Extension


dalto
09-05-2007, 02:06
This is a very simple extension to expose some functionality that cannot currently be accessed via Sourcemod directly.

Currently 3 forwards are exposed.


/**
* @brief Called to determine if a player can use a given weapon
*
* @param client A client index
* @param weapon The classname of the weapon
* @return Plugin_Handled to block usage, Plugin_Continue to allow it.
*/
forward Action:Weapon_CanUse(client, const String:weapon[]);

/**
* @brief Called when the active weapon changes
*
* @param client A client index
* @param oldWeapon The weapon entity index of the weapon switching from
* @param newWeapon The weapon entity index of the weapon switching to
* @return None
*/
forward OnChangeActiveWeapon(client, oldWeapon, newWeapon);

/**
* @brief Called to determine if a player can switch to a given weapon
*
* @param client A client index
* @param weapon The classname of the weapon
* @return Plugin_Handled to block usage, Plugin_Continue to allow it.
*/
forward Action:Weapon_CanSwitchTo(client, const String:weapon[]);I would warn the OnChangeActiveWeapon() probably doesn't do what you would expect. I left it in because it can be used to catch certain events.

The focus with this extension is simplicity, I tried to make these functions as simple as possible to use. In doing so I have sacrificed some of the flexibility and power that something like the hacks extension has.

I will be adding to this over time so let me know if you need anything specific.

I believe that the ability to hook virtual forwards is something that will eventually be added to sourcemod but this is intended to help in the interim.

Instructions:
Copy the extension to your addons/sourcemod/extensions directory and include the include file in your plugin. You also need to copy the weapons.games.txt file to your addons/sourcemod/gamedata directory.

The source code (http://users.svn.alliedmods.net/viewvc.cgi/weapons%20extension/?root=dalto) is also available.

Supported Mods:
Counter Strike: Source
Day of Defeat: Source
Halflife2: Deathmatch
Sourceforts
Pirates, Vikings and Knights
Insurgency(Weapon_CanUse and Weapon_CanSwitchTo only)

dalto
09-05-2007, 02:07
I should warn that the linux binary is somewhat untested. I have tested the Windows binary extensively though.

EDIT: I just noticed that all the function briefs are the same. I will fix it tomorrow when I am more awake.

BAILOPAN
09-06-2007, 08:29
Looks good ;)

Since you didn't include a gameconf file, you may wish to note that it's specific to a game.

dalto
09-06-2007, 09:31
Since you didn't include a gameconf file, you may wish to note that it's specific to a game.

Good point.

As it is it should work with:

Counter-Strike Source
Day of Defeat Source
Halflife 2: Deathmatch
and PVK

If anyone needs something else I can change this to read the function offsets from a gamecon file at runtime.

dalto
09-06-2007, 23:45
I added a gameconf file as BAILOPAN suggested.

I also added support for the following games:
Insurgency
Sourceforts

bobbobagan
09-07-2007, 19:49
This extention caused major problems on my linux server, when somebody fired a gun it would crash the server making it unplayable. Just letting you know

dalto
09-07-2007, 22:37
This extention caused major problems on my linux server, when somebody fired a gun it would crash the server making it unplayable. Just letting you know

What mod was it and what script were you using that used it?

EDIT: Hmm...I was able to duplicate this. I will try to figure out why it does not work with linux.

dalto
09-08-2007, 17:51
The linux binary should be fixed now.

Make sure you also cp weapons.games.txt to your gamedata directory

steambob
09-20-2007, 11:59
well, sorry, but i do not find a link to download binaries (i would like to try the linux ones). could you add it ?

or am i blind? :)

thanks.

SamuraiBarbi
09-25-2007, 02:30
yeah where's the download at?

tkaway69
09-27-2007, 22:47
1v1 needs this extension. How can we go about getting it or should the "1v1" plugin and this extension be removed?

tkaway69
01-29-2008, 00:27
Any word on the weapons extensions.ext dll file for the 1v1 plugin by Dalto.

tkaway69
01-29-2008, 17:24
Can some one with knowledge please post some info on this. The last edit we see from Dalto says
"Last edited by dalto : 09-09-07 at 07:42 AM. Reason: New Release"

There is nothing about it being removed anywhere that I can find. So whats up?

Etch1P
02-19-2008, 08:31
Please someone compile the extension for linux or post pre-compiled binary.

I can't run the 1v1 plugin. the ext is no where.

tkaway69
02-22-2008, 21:23
Good luck.... This is a dead extension it seems.

Artemisfo
02-23-2008, 11:18
I copied all th efiles to the following directories but it still say "Unable to load plugin 1v1.smx Weapons.ext needed" What should i do? I have weapons.ini in the correct directory and i have even pasted weapond.ext.dll and weapons.ext files there. It didnt help

tkaway69
02-24-2008, 11:50
Where did you find a "weapond.ext.dll"? Good luck.

Etch1P
03-01-2008, 04:53
dalto, speak up...

we need this plugin working

someone help!

SamuraiBarbi
05-19-2009, 18:20
There's no download link for the compiled extension. Does anyone happen to have the compiled windows or linux versions for this?

psychonic
06-23-2009, 13:54
There's no download link for the compiled extension. Does anyone happen to have the compiled windows or linux versions for this?

Better late than never...

Attached is the Windows version compiled (untested, but compiled without error).

Don't forget to grab the weapons.games.txt from the link on the original post, as well as the weapons.inc if you need it to compile a plugin.

I may attempt to compile the linux version later if you or anyone still needs it.

TT_cRy
10-10-2009, 08:05
Hi !
Can any one compile that extension for LINUX ?! PLEASE FRINDS ! I very very need that extension for Linux. I have full worked "weaponswitsh OFF" version of Plugin for DOD:S but is worked only for Windows. I need this EXTENSION. Than i can say to plugin Developer and he make compiling for a dll File. He say me that we need worked weapon extension for this compiling. HELP ME FRINDS ! PLEASE!

psychonic
10-11-2009, 11:35
Hi !
Can any one compile that extension for LINUX ?! PLEASE FRINDS ! I very very need that extension for Linux. I have full worked "weaponswitsh OFF" version of Plugin for DOD:S but is worked only for Windows. I need this EXTENSION. Than i can say to plugin Developer and he make compiling for a dll File. He say me that we need worked weapon extension for this compiling. HELP ME FRINDS ! PLEASE!

Oh look, the same message (and color) spammed to me (and probably others) in unsolicited PMs.

Timiditas
10-13-2009, 19:21
I wonder if one of the function this extension exposes could be used to get rid of the weapon switch delay. In Gungame turbo mode, it sucks when you raise level in the middle of a fight against multiple players, because you can't fire for a short time.