View Full Version : Dod Rocket Class (Better Secondary Wpn) v2.0
Wilson [29th ID]
04-05-2008, 04:51 PM
Dod Rocket Class
This plugin gives the Bazooka class an M1 Carbine instead of a Colt
This plugin gives the Panzerjaeger class an MP40 isntead of a Luger
This plugin gives the Piat class a Sten instead of a Webley
The idea was taken from DOD:Source - why shouldn't 1.3 have it too?
Now these classes can be used effectively and do quite some damage.
We have people in my servers who only use this class because it's actually usefull now.
This plugin replaces Dod Technician (http://dodplugins.net/forums/showthread.php?t=531), but is technically a totally different plugin as the code is 100% different and more efficient. If you look at the SMA, there are only 3 functions and a few stocks in this plugin. Much more concise than the "rigged" method of Dod Technician. This plugin actually gives you the secondary weapon and sets it to your secondary slot. Quickswitching works..scrolling works..etc. It's "foolproof"
This would not have been possible without Sawce's hamsandwich module.
Only Known Bugs
-As of now, if you drop one of your weapons, you cannot pick it back up. I could code it so that you could, but that will simply increase the chances of server crashes. Better to leave it like this - how often do you drop your weapon anyway?
-When you die, you drop your secondary instead of your primary (rocket). Not sure how to fix this but who cares.
Usage
Just select the Bazooka/Panzerjaeger/Piat class. Scroll through your weapons and you'll see it.
Sorry it took so long to come out.
TigerMan4
04-05-2008, 05:01 PM
I drop my bazooka etc when I run out of ammo , though with the old plugin , you never ran out of ammo...so no need to drop your wepon right ?
If you run out of rockets , it would be nice to be able to pick up somthing more affective than an mp40 or carbine...like a bar or a bren.
Box Cutter
04-05-2008, 07:39 PM
Wilson, good to see this plugin finally released. I am on a DoD break right now but I will definately try it out if I start another DoD server.
Odd i got this:
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/tmp3/php06dPhO.sma(5) : fatal error 100: cannot read from file: "dod_stocks"
Compilation aborted.
1 Error.
Wilson [29th ID]
04-05-2008, 11:09 PM
If you run out of rockets , it would be nice to be able to pick up somthing more affective than an mp40 or carbine...like a bar or a bren.
You can do that. Just drop both your zook and your carbine and you can pick up whatever you want. Woulda be kinda unfair if you could keep your kickass secondary and pickup a bar...
diamond-optic
04-05-2008, 11:47 PM
Odd i got this:
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/tmp3/php06dPhO.sma(5) : fatal error 100: cannot read from file: "dod_stocks"
Compilation aborted.
1 Error.
here's the dod_stocks include (you will have to compile it locally until zor puts it up on the web compiler if thats what youre trying)
http://www.dodplugins.net/forums/showthread.php?t=1101
but even with that im getting "Error: Undefined symbol "dod_get_weapon_id" on line 148"
so wilson do you have a updated dod_stocks file that isnt attached in that thread?
Ok cool thx so far :)
Well now i tryed to compile it on my own machine. First error i got was that i didnt have fakemeta_util, but that was easy to find, downloaded this: http://forums.alliedmods.net/showthread.php?t=28284&highlight=fakemeta_util (could be updated)
Now i get: blahblah\dod_rocketclass.sma(148) : error 017: undefined symbol "dod_get_weapon_id"
//
//
//
blahblah\dod_rocketclass.amx (compile failed).
:confused:
Could this plugin have a kinda "install for dummies walk through??" :rolleyes:
Hehe any ideas what iam doing wrong?
Thx in advance..
Wilson [29th ID]
04-06-2008, 12:13 PM
Haha, damnit. Why do I forget these things. I'll upload the fixed version now.
EDIT: Okay, now you don't need dod_stocks or fm_util and it compiles fine.
Woohooo, now it compile... But amxmodxs online compiler dont like #include <hamsandwich>
If anyone that dont know how to compile on your local machine read here http://www.dodplugins.net/forums/showthread.php?t=50
Thx to Wilson...
*edit*
Wel it load fine on my server but it crashes when i pick the bazooka class. Any ideas? I have loaded the last dod_stocks that Wilson put up today...
meathead
04-06-2008, 07:17 PM
Ok, need some help
amx_plugins
( 40) Load fails: Plugin uses an unknown function (name "ExecuteHamB") - check your modules.ini.
amx_modules
Ham Sandwich 1.8.0.3660 AMX Mod X Dev Team running
Wilson [29th ID]
04-06-2008, 10:44 PM
You probably have an outdated version of ham sandwich or something...that's definitely an hs function..
meathead
04-06-2008, 11:47 PM
yea thought about that wilson. spent an hour trying to find it on amxmodx. my version is from 10-27-07. could you give a link if there is a newer one?
Also if it makes a difference, were running linux.
edit: got it! hamsandwich.ini was missing!
update: Server crashes when I choose panzerschrek. I've got the plugin in debug, nothing in the logs. How can I get more information for you?
Wilson [29th ID]
04-07-2008, 01:53 PM
haha, I just tested it and got the same thing. This is from me editing it and adding "dod_client_spawn" instead of my hook, "dod_player_spawn"
Believe it or not, lol, dod_player_spawn works better than the new module fix because it adds a 0.1 delay. If you try to send any kind of message (message_begin) on dod_client_spawn without a 0.1 delay, the server will crash. I'll report it in the DoDx module thread.
Anyway, problem fixed - I added the delay and the file is uploaded and tested
meathead
04-07-2008, 06:49 PM
Works great now. Thanks Wilson. Nice job.
Wilson [29th ID]
04-08-2008, 05:32 PM
I just uploaded the .amxx since the webcompiler doesn't roll with hamsandwich and O'Connell is a nub.
Campbell [82nd AB]
04-08-2008, 05:34 PM
I award wilson the grand prize for awesomeness!
*hands wilson a coupon for free lawlcake"
Congraduations wilson!
Hood [10th MD]
04-10-2008, 06:14 PM
Amen to O'Connell = nub
Just to clarify Wilson, you mentioned above that you can drop both weapons - this is correct, right? I'm thinking in terms of running weapons mod as well - if the player now has a carbine as a secondary, instead of just being stripped and not given a pistol, you'd need to drop the weapons twice basically... anyways - can you drop both is my question haha
Wilson [29th ID]
04-11-2008, 08:38 AM
http://www.tux.org/~bagleyd/unicycle_factory/cartoons/yes.gif
TigerMan4
04-12-2008, 04:32 PM
wait.... with this version you can drop your secondary wepon too ?
why not make a plugin that you can do that with every class...hahahaha...run out of pistol ammo...drop your pistol..pick up a bar or an mg42. :)
Wilson [29th ID]
04-12-2008, 05:28 PM
No, TigerMan.....did you read the description?
It gives you an m1carbine or mp40 or sten as your secondary, which you can drop. gaah.
TigerMan4
04-13-2008, 01:03 AM
yeah...but if you could write a plugin , where you could drop your pistol..WOOHOO!
diamond-optic
04-13-2008, 01:13 AM
yeah...but if you could write a plugin , where you could drop your pistol..WOOHOO!
i dont wanna take this off topic, and feel free to delete this wilson..
but with the ham sandwich module, i started messing around with being able to strip just the players pistol and such as a start towards being able to drop any weapon, but ran into random crashes and havent had time to really mess around with it much
rushnnoob
04-24-2008, 10:54 PM
Are there any Cvars to put in?
Thanks,
{KHH} RUSH-N-NOOB
diamond-optic
04-25-2008, 04:56 AM
Are there any Cvars to put in?
just dod_rocketclass
to enable/disable it, defaults as "1"
bdjohns
06-30-2008, 11:26 PM
20:20:57 [META] ERROR: Failed to find memloc for regcmd 'ham'
20:20:57 [META] dll: Loaded plugin 'Ham Sandwich': Ham Sandwich v1.8.0.3660 Oct 25 2007, AMX Mod X Dev Team
20:20:57 [HAMSANDWICH] Unable to open "dod\addons\amxmodx\configs/hamdata.ini" for reading.
20:20:57 [HAMSANDWICH] Error: Cannot read config file, natives not registered!
20:20:57 [AMXX] Plugin "dod_rocketclass.amxx" failed to load: Plugin uses an unknown function (name "ExecuteHamB") - check your modules.ini.
meathead
07-01-2008, 08:54 AM
update your amx files and install the hamdata.ini file.
Fireguy
07-17-2008, 12:05 AM
is anyone else having a problem with it going back to pistols after one side caps out?
meathead
07-17-2008, 02:26 AM
nope, my vote for best mod ever!
Fireguy
07-17-2008, 01:19 PM
It doesn't stay on pistol, just the first respawn after a cap. After you die, you'll respawn with whatever secondary weapon the mod is suppose to give you.
diamond-optic
07-17-2008, 05:27 PM
it because it uses dod_client_spawn which hasnt been fixed yet..
diamond-optic
12-20-2008, 10:29 PM
nothing major and easy to fix.. but i guess i should mention it...
i was getting lots of invalid player errors on the dod_client_spawn_delayed function
..havent got any more errors since adding a is_user_connected check before getting the client's class
{RSR}Crazyhorse_cdn
04-15-2010, 11:04 PM
will this plug in work with giveammo ?? or will i have to disable my giveammo because as it stands now i get 15 shells for what ever i have , bazooka, piat, panzershrek ????
will this plug in work with giveammo ?? or will i have to disable my giveammo because as it stands now i get 15 shells for what ever i have , bazooka, piat, panzershrek ????
What stops you from testing it yourself?
shortround
09-12-2011, 07:52 AM
This plugin gives error,
L 09/12/2011 - 04:28:43: [DODX] Invalid player 1
L 09/12/2011 - 04:28:43: [AMXX] Displaying debug trace (plugin "dod_rocketclass.amxx")
L 09/12/2011 - 04:28:43: [AMXX] Run time error 10: native error (native "dod_get_user_class")
L 09/12/2011 - 04:28:43: [AMXX] [0] dod_rocketclass.sma::dod_client_spawn_delayed (line 71)
#include <amxmodx>
#include <amxmisc>
#include <dodfun>
#include <dodx>
#include <fakemeta>
#include <hamsandwich>
#pragma semicolon 1
#define PLUGIN "DOD Rocket Class"
#define VERSION "2.0"
#define AUTHOR "29th ID"
#define OFFSET_WPN_ID 91
#define OFFSET_LINUX 4
#define MAX_CARBINE 45
#define MAX_MP40 90
#define MAX_STEN 90
// Global variables
new g_msgWeaponList, g_msgAmmoX, g_cvarEnabled;
// String Declarations
enum classnames {
weapon_,
colt,
luger,
webley,
m1carbine,
mp40,
sten
};
new const g_classnames[ classnames ][ ] = {
"weapon_",
"weapon_colt",
"weapon_luger",
"weapon_webley",
"weapon_m1carbine",
"weapon_mp40",
"weapon_sten"
};
// For WeaponList
enum { melee, secondary, primary }
enum tech_weapons { TECH_M1CARBINE, TECH_MP40, TECH_STEN };
enum tech_categories { t_wpnid, t_ammotype, t_maxammo, t_clip, t_flags };
new g_wpncfg [ tech_weapons ][ tech_categories ] =
{
{ DODW_M1_CARBINE, AMMO_ALTRIFLE, MAX_CARBINE, 15, 128 },
{ DODW_MP40, AMMO_SMG, MAX_MP40, 30, 130 },
{ DODW_STEN, AMMO_SMG, MAX_STEN, 30, 128 }
};
public plugin_init() {
register_plugin( PLUGIN, VERSION, AUTHOR );
g_msgWeaponList = get_user_msgid( "WeaponList" );
g_msgAmmoX = get_user_msgid( "AmmoX" );
g_cvarEnabled = register_cvar( "dod_rocketclass", "1" );
register_cvar( "dod_rocketclass_stats", "2.0", FCVAR_SERVER|FCVAR_SPONLY );
}
public dod_client_spawn( id ) {
if( get_pcvar_num(g_cvarEnabled) )
{
set_task( Float:0.1, "dod_client_spawn_delayed", id );
}
}
public dod_client_spawn_delayed( id ) {
switch( dod_get_user_class(id) )
{
case DODC_BAZOOKA:
{
ham_strip_weapon( id, g_classnames[colt] );
ham_give_weapon( id, g_classnames[m1carbine] );
limit_ammo( id, TECH_M1CARBINE );
}
case DODC_PANZERJAGER:
{
ham_strip_weapon( id, g_classnames[luger] );
ham_give_weapon( id, g_classnames[mp40] );
limit_ammo( id, TECH_MP40 );
}
case DODC_PIAT:
{
ham_strip_weapon( id, g_classnames[webley] );
ham_give_weapon( id, g_classnames[sten] );
limit_ammo( id, TECH_STEN );
}
}
return PLUGIN_CONTINUE;
}
public dod_client_changeclass( id, class, oldclass ) {
if( get_pcvar_num(g_cvarEnabled) )
{
switch( class )
{
case DODC_BAZOOKA: set_slot( id, TECH_M1CARBINE, secondary );
case DODC_PANZERJAGER: set_slot( id, TECH_MP40, secondary );
case DODC_PIAT: set_slot( id, TECH_STEN, secondary );
}
switch( oldclass )
{
case DODC_BAZOOKA: set_slot( id, TECH_M1CARBINE, primary );
case DODC_PANZERJAGER: set_slot( id, TECH_MP40, primary );
case DODC_PIAT: set_slot( id, TECH_STEN, primary );
}
}
}
public set_slot( id, wpn, slot ) {
message_begin( MSG_ONE, g_msgWeaponList, {0,0,0}, id );
write_byte( g_wpncfg[tech_weapons:wpn][t_ammotype] ); // Ammo 1 Type
write_byte( g_wpncfg[tech_weapons:wpn][t_maxammo] ); // Ammo 1 Max
write_byte( -1 ); // Ammo 2 Type
write_byte( -1 ); // Ammo 2 Max
write_byte( slot ); // Slot (Starts at 0)
write_byte( 1 ); // Bucket (Starts at 0)
write_short(g_wpncfg[tech_weapons:wpn][t_wpnid] ); // Weapon ID
write_byte( g_wpncfg[tech_weapons:wpn][t_flags] ); // Flags
write_byte( g_wpncfg[tech_weapons:wpn][t_clip] ); // Clip Ammo
message_end();
//client_print( id, print_chat, "[Slot] Ammo1:%i, Max:%i, slot:%i, Wpnid:%i, Flags:%i, Clip:%i", g_wpncfg[tech_weapons:wpn][t_ammotype], g_wpncfg[tech_weapons:wpn][t_maxammo], slot, g_wpncfg[tech_weapons:wpn][t_wpnid], g_wpncfg[tech_weapons:wpn][t_flags], g_wpncfg[tech_weapons:wpn][t_clip] );
}
// Stock written by XxAvalanchexX
// gives a player a weapon efficiently
stock ham_give_weapon(id,const weapon[]) {
if(!equal(weapon,g_classnames[weapon_],7)) return 0;
new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_ AllocString,weapon));
if(!pev_valid(wEnt)) return 0;
set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);
dllfunc(DLLFunc_Spawn,wEnt);
if(!ExecuteHamB(Ham_AddPlayerItem,id,any:wEnt) || !ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,any:id))
{
if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) & FL_KILLME);
return 0;
}
return 1;
}
// Stock written by XxAvalanchexX
// takes a weapon from a player efficiently
stock ham_strip_weapon(id,const weapon[]) {
if(!equal(weapon,g_classnames[weapon_],7)) return 0;
new wEnt = fm_find_ent_by_owner(1,weapon,id);
if(!wEnt) return 0;
new wId = dod_get_weapon_id(wEnt);
if(!wId) return 0;
new dummy, weapon = get_user_weapon(id,dummy,dummy);
if(weapon == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
if(!ExecuteHamB(Ham_RemovePlayerItem,id,any:wEnt)) return 0;
ExecuteHamB(Ham_Item_Kill,wEnt);
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));
return 1;
}
stock limit_ammo( id, wpn ) {
new wpnid = g_wpncfg[ tech_weapons:wpn ][ t_wpnid ];
new channel = g_wpncfg[ tech_weapons:wpn ][ t_ammotype ];
new ammo = g_wpncfg[ tech_weapons:wpn ][ t_maxammo ];
dod_set_user_ammo( id, wpnid, ammo );
message_begin( MSG_ONE, g_msgAmmoX, {0,0,0}, id );
write_byte( channel );
write_byte( ammo );
message_end();
}
stock dod_get_weapon_id( wpnent ) return get_pdata_int( wpnent, OFFSET_WPN_ID, OFFSET_LINUX );
// From FM Utilities...pasted in here for people who can't figure out how to compile with the inc...
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
new strtype[11] = "classname", ent = index;
switch (jghgtype) {
case 1: strtype = "target";
case 2: strtype = "targetname";
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent;
}
help appreciated.
meathead
09-21-2011, 12:47 AM
What version of metamod and amx are you running?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.