Dod Rocket Class (Better Secondary Wpn) v2.0
by Wilson [29th ID] · 2008-04-05 · 34 replies · 29371 views · 309 downloads
From the first post
rnThis plugin gives the Bazooka class an M1 Carbine instead of a Colt
rnThis plugin gives the Panzerjaeger class an MP40 isntead of a Luger
rnThis plugin gives the Piat class a Sten instead of a Webley
rn
rnThe idea was taken from DOD:Source - why shouldn't 1.3 have it too?
rnNow these classes can be used effectively and do quite some damage.
rnWe have people in my servers who only use this class because it's actually usefull now.
rn
rnThis plugin replaces Dod Technician, 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"
rn
rnThis would not have been possible without Sawce's hamsandwich module.
rn
rnOnly Known Bugs
rn-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?
rn-When you die, you drop your secondary instead of your primary (rocket). Not sure how to fix this but who cares.
rn
rnUsage
rnJust select the Bazooka/Panzerjaeger/Piat class. Scroll through your weapons and you'll see it.
rn
rnSorry it took so long to come out.
The thread
All 35 posts from 13 people on Dod Rocket Class (Better Secondary Wpn) v2.0, kept as they were written.
Threads: 57
Joined: Oct 2005
Dod Rocket ClassrnThis plugin gives the Bazooka class an M1 Carbine instead of a ColtrnThis plugin gives the Panzerjaeger class an MP40 isntead of a LugerrnThis plugin gives the Piat class a Sten instead of a WebleyrnrnThe idea was taken from DOD:Source - why shouldn't 1.3 have it too?rnNow these classes can be used effectively and do quite some damage.rnWe have people in my servers who only use this class because it's actually usefull now.rnrnThis plugin replaces Dod Technician, 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"rnrnThis would not have been possible without Sawce's hamsandwich module.rnrnOnly Known Bugsrn-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?rn-When you die, you drop your secondary instead of your primary (rocket). Not sure how to fix this but who cares.rnrnUsagernJust select the Bazooka/Panzerjaeger/Piat class. Scroll through your weapons and you'll see it.rnrnSorry it took so long to come out.
Threads: 37
Joined: Aug 2006
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 ?rnrnIf 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.
Threads: 7
Joined: Jun 2006
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.
Threads: 75
Joined: Nov 2007
Odd i got this:rnrn
Your plugin failed to compile! Read the errors below:rnrnWelcome to the AMX Mod X 1.76-300 Compiler.rnCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamrnrn/home/groups/amxmodx/tmp3/php06dPhO.sma(5) : fatal error 100: cannot read from file: "dod_stocks"rnrnCompilation aborted.rn1 Error.rnrnThreads: 57
Joined: Oct 2005
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.rnrnYou 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...
Threads: 103
Joined: May 2005
Odd i got this:nnnnhere'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)nhttps://www.dodplugins.net/forums/showthread.php?t=1101nnnbut even with that im getting "Error: Undefined symbol "dod_get_weapon_id" on line 148"nso wilson do you have a updated dod_stocks file that isnt attached in that thread?Your plugin failed to compile! Read the errors below:nnWelcome to the AMX Mod X 1.76-300 Compiler.nCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamnn/home/groups/amxmodx/tmp3/php06dPhO.sma(5) : fatal error 100: cannot read from file: "dod_stocks"nnCompilation aborted.n1 Error.nn
Threads: 75
Joined: Nov 2007
Ok cool thx so far :) rnrnWell 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)rnrnNow i get: blahblahdod_rocketclass.sma(148) : error 017: undefined symbol "dod_get_weapon_id"rn//rn//rn//rnblahblahdod_rocketclass.amx (compile failed).rnrn:confused:rnrnCould this plugin have a kinda "install for dummies walk through??" :rolleyes:rnrnHehe any ideas what iam doing wrong?rnrnThx in advance..
Threads: 57
Joined: Oct 2005
Haha, damnit. Why do I forget these things. I'll upload the fixed version now.nnEDIT: Okay, now you don't need dod_stocks or fm_util and it compiles fine.
Threads: 75
Joined: Nov 2007
Woohooo, now it compile... But amxmodxs online compiler dont like #include <hamsandwich>rnrnIf anyone that dont know how to compile on your local machine read here https://www.dodplugins.net/forums/showthread.php?t=50rnrnThx to Wilson...rnrn*edit*rnrnWel 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...
Threads: 23
Joined: Aug 2007
Ok, need some helpnnamx_pluginsnn( 40) Load fails: Plugin uses an unknown function (name "ExecuteHamB") - check your modules.ini.nnamx_modulesnHam Sandwich 1.8.0.3660 AMX Mod X Dev Team running
Threads: 57
Joined: Oct 2005
You probably have an outdated version of ham sandwich or something...that's definitely an hs function..
Threads: 23
Joined: Aug 2007
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?nAlso if it makes a difference, were running linux.nnnedit: got it! hamsandwich.ini was missing!nnnupdate: 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?
Threads: 57
Joined: Oct 2005
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"nnBelieve 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.nnAnyway, problem fixed - I added the delay and the file is uploaded and tested
Threads: 23
Joined: Aug 2007
Works great now. Thanks Wilson. Nice job.
Threads: 57
Joined: Oct 2005
I just uploaded the .amxx since the webcompiler doesn't roll with hamsandwich and O'Connell is a nub.
Threads: 2
Joined: Dec 2007
I award wilson the grand prize for awesomeness! nnnn*hands wilson a coupon for free lawlcake"nnnCongraduations wilson!
Threads: 7
Joined: Nov 2006
Amen to O'Connell = nubnnJust 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
Threads: 57
Joined: Oct 2005

Threads: 37
Joined: Aug 2006
wait.... with this version you can drop your secondary wepon too ?rnrnwhy 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. :)
Threads: 57
Joined: Oct 2005
No, TigerMan.....did you read the description?nnIt gives you an m1carbine or mp40 or sten as your secondary, which you can drop. gaah.
Threads: 37
Joined: Aug 2006
yeah...but if you could write a plugin , where you could drop your pistol..WOOHOO!
Threads: 103
Joined: May 2005
yeah...but if you could write a plugin , where you could drop your pistol..WOOHOO!nni dont wanna take this off topic, and feel free to delete this wilson..nnbut 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
Threads: 0
Joined: Jan 2008
Are there any Cvars to put in?rnrnrnThanks, rnrn{KHH} RUSH-N-NOOB
Threads: 103
Joined: May 2005
Are there any Cvars to put in?nnjust dod_rocketclassnnto enable/disable it, defaults as "1"
Threads: 0
Joined: Jul 2005
20:20:57 [META] ERROR: Failed to find memloc for regcmd 'ham'rn20:20:57 [META] dll: Loaded plugin 'Ham Sandwich': Ham Sandwich v1.8.0.3660 Oct 25 2007, AMX Mod X Dev Teamrn20:20:57 [HAMSANDWICH] Unable to open "dodaddonsamxmodxconfigs/hamdata.ini" for reading.rn20:20:57 [HAMSANDWICH] Error: Cannot read config file, natives not registered!rn20:20:57 [AMXX] Plugin "dod_rocketclass.amxx" failed to load: Plugin uses an unknown function (name "ExecuteHamB") - check your modules.ini.
Threads: 23
Joined: Aug 2007
update your amx files and install the hamdata.ini file.
Threads: 1
Joined: Jul 2008
is anyone else having a problem with it going back to pistols after one side caps out?
Threads: 23
Joined: Aug 2007
nope, my vote for best mod ever!
Threads: 1
Joined: Jul 2008
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.
Threads: 103
Joined: May 2005
it because it uses dod_client_spawn which hasnt been fixed yet..
Threads: 103
Joined: May 2005
nothing major and easy to fix.. but i guess i should mention it...nni was getting lots of invalid player errors on the dod_client_spawn_delayed functionn..havent got any more errors since adding a is_user_connected check before getting the client's class
Threads: 47
Joined: Sep 2006
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 ????
Threads: 75
Joined: Nov 2007
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 ????rnrnrnWhat stops you from testing it yourself?
Threads: 0
Joined: Dec 2010
This plugin gives error,rnrn
rnL 09/12/2011 - 04:28:43: [DODX] Invalid player 1rnL 09/12/2011 - 04:28:43: [AMXX] Displaying debug trace (plugin "dod_rocketclass.amxx")rnL 09/12/2011 - 04:28:43: [AMXX] Run time error 10: native error (native "dod_get_user_class")rnL 09/12/2011 - 04:28:43: [AMXX] [0] dod_rocketclass.sma::dod_client_spawn_delayed (line 71)rnrnrnrnrn#include <amxmodx>rn#include <amxmisc>rn#include <dodfun>rn#include <dodx>rn#include <fakemeta>rn#include <hamsandwich>rnrn#pragma semicolon 1rnrn#define PLUGIN "DOD Rocket Class"rn#define VERSION "2.0"rn#define AUTHOR "29th ID"rnrn#define OFFSET_WPN_ID 91rn#define OFFSET_LINUX 4rn#define MAX_CARBINE 45rn#define MAX_MP40 90rn#define MAX_STEN 90rnrn// Global variablesrnnew g_msgWeaponList, g_msgAmmoX, g_cvarEnabled;rnrn// String Declarationsrnenum classnames {rn weapon_,rn colt,rn luger,rn webley,rn m1carbine,rn mp40,rn stenrn};rnnew const g_classnames[ classnames ][ ] = {rn "weapon_",rn "weapon_colt",rn "weapon_luger",rn "weapon_webley",rn "weapon_m1carbine",rn "weapon_mp40",rn "weapon_sten"rn};rnrn// For WeaponListrnenum { melee, secondary, primary }rnenum tech_weapons { TECH_M1CARBINE, TECH_MP40, TECH_STEN };rnenum tech_categories { t_wpnid, t_ammotype, t_maxammo, t_clip, t_flags };rnnew g_wpncfg [ tech_weapons ][ tech_categories ] = rn{rn { DODW_M1_CARBINE, AMMO_ALTRIFLE, MAX_CARBINE, 15, 128 },rn { DODW_MP40, AMMO_SMG, MAX_MP40, 30, 130 },rn { DODW_STEN, AMMO_SMG, MAX_STEN, 30, 128 }rn};rnrnpublic plugin_init() {rn register_plugin( PLUGIN, VERSION, AUTHOR );rn rn g_msgWeaponList = get_user_msgid( "WeaponList" );rn g_msgAmmoX = get_user_msgid( "AmmoX" );rn g_cvarEnabled = register_cvar( "dod_rocketclass", "1" );rn register_cvar( "dod_rocketclass_stats", "2.0", FCVAR_SERVER|FCVAR_SPONLY );rn}rnrnpublic dod_client_spawn( id ) {rn if( get_pcvar_num(g_cvarEnabled) )rn {rn set_task( Float:0.1, "dod_client_spawn_delayed", id );rn }rn}rnrnpublic dod_client_spawn_delayed( id ) {rn switch( dod_get_user_class(id) )rn {rn case DODC_BAZOOKA:rn {rn ham_strip_weapon( id, g_classnames[colt] );rn ham_give_weapon( id, g_classnames[m1carbine] );rn limit_ammo( id, TECH_M1CARBINE );rn }rn case DODC_PANZERJAGER:rn {rn ham_strip_weapon( id, g_classnames[luger] );rn ham_give_weapon( id, g_classnames[mp40] );rn limit_ammo( id, TECH_MP40 );rn }rn case DODC_PIAT:rn {rn ham_strip_weapon( id, g_classnames[webley] );rn ham_give_weapon( id, g_classnames[sten] );rn limit_ammo( id, TECH_STEN );rn }rn }rn return PLUGIN_CONTINUE;rn}rnrnpublic dod_client_changeclass( id, class, oldclass ) {rn if( get_pcvar_num(g_cvarEnabled) )rn {rn switch( class )rn {rn case DODC_BAZOOKA: set_slot( id, TECH_M1CARBINE, secondary );rn case DODC_PANZERJAGER: set_slot( id, TECH_MP40, secondary );rn case DODC_PIAT: set_slot( id, TECH_STEN, secondary );rn }rn switch( oldclass )rn {rn case DODC_BAZOOKA: set_slot( id, TECH_M1CARBINE, primary );rn case DODC_PANZERJAGER: set_slot( id, TECH_MP40, primary );rn case DODC_PIAT: set_slot( id, TECH_STEN, primary );rn }rn }rn}rnrnpublic set_slot( id, wpn, slot ) {rn message_begin( MSG_ONE, g_msgWeaponList, {0,0,0}, id );rn write_byte( g_wpncfg[tech_weapons:wpn][t_ammotype] ); // Ammo 1 Typern write_byte( g_wpncfg[tech_weapons:wpn][t_maxammo] ); // Ammo 1 Maxrn write_byte( -1 ); // Ammo 2 Typern write_byte( -1 ); // Ammo 2 Maxrn write_byte( slot ); // Slot (Starts at 0)rn write_byte( 1 ); // Bucket (Starts at 0)rn write_short(g_wpncfg[tech_weapons:wpn][t_wpnid] ); // Weapon IDrn write_byte( g_wpncfg[tech_weapons:wpn][t_flags] ); // Flagsrn write_byte( g_wpncfg[tech_weapons:wpn][t_clip] ); // Clip Ammorn message_end();rn //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] );rn}rnrn// Stock written by XxAvalanchexXrn// gives a player a weapon efficientlyrnstock ham_give_weapon(id,const weapon[]) {rn if(!equal(weapon,g_classnames[weapon_],7)) return 0;rn rn new wEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));rn if(!pev_valid(wEnt)) return 0;rn rn set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);rn dllfunc(DLLFunc_Spawn,wEnt);rn rn if(!ExecuteHamB(Ham_AddPlayerItem,id,any:wEnt) || !ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,any:id))rn {rn if(pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) & FL_KILLME);rn return 0;rn }rn rn return 1;rn}rnrn// Stock written by XxAvalanchexXrn// takes a weapon from a player efficientlyrnstock ham_strip_weapon(id,const weapon[]) {rn if(!equal(weapon,g_classnames[weapon_],7)) return 0;rn rn new wEnt = fm_find_ent_by_owner(1,weapon,id);rn if(!wEnt) return 0;rnrn new wId = dod_get_weapon_id(wEnt);rn if(!wId) return 0;rn rn new dummy, weapon = get_user_weapon(id,dummy,dummy);rn if(weapon == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);rn rn if(!ExecuteHamB(Ham_RemovePlayerItem,id,any:wEnt)) return 0;rn ExecuteHamB(Ham_Item_Kill,wEnt);rn rn set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));rn return 1;rn}rnrnstock limit_ammo( id, wpn ) {rn new wpnid = g_wpncfg[ tech_weapons:wpn ][ t_wpnid ];rn new channel = g_wpncfg[ tech_weapons:wpn ][ t_ammotype ];rn new ammo = g_wpncfg[ tech_weapons:wpn ][ t_maxammo ];rn rn dod_set_user_ammo( id, wpnid, ammo );rn rn message_begin( MSG_ONE, g_msgAmmoX, {0,0,0}, id );rn write_byte( channel );rn write_byte( ammo );rn message_end();rn}rnrnstock dod_get_weapon_id( wpnent ) return get_pdata_int( wpnent, OFFSET_WPN_ID, OFFSET_LINUX );rnrn// From FM Utilities...pasted in here for people who can't figure out how to compile with the inc...rnstock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {rn new strtype[11] = "classname", ent = index;rn switch (jghgtype) {rn case 1: strtype = "target";rn case 2: strtype = "targetname";rn }rnrn while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}rnrn return ent;rn}rnrnrnrnhelp appreciated.Threads: 23
Joined: Aug 2007
What version of metamod and amx are you running?

