Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › Converting CS new_henade_efx to DOD
3 posts, 2 people · 851 views Thread Rating: ★★★★★
closedConverting CS new_henade_efx to DOD
Started by DFHServer on 05-17-2007, 03:45 AM
DFHServer
started this thread
Posts: 16
Threads: 3
Joined: Feb 2005
05-17-2007, 03:45 AM #1

I changed it parts to "dodx" instead of "csx"....rnand replaced the check if grenade isn't a HeGrenadern if(wid != CSW_HEGRENADE)rnwithrn if(wid != DODW_STICKGRENADE)rnthat worked for Axis and if we put inrn if(wid != DODW_HANDGRENADE)rnthat worked for Allies, so I modified it with an ORrn if(wid != DODW_STICKGRENADE || wid != DODW_HANDGRENADE)rnBut, the effects work with AXIS, but not Alliesrn Below is the script... rnIf you see anything that might need to be changed, let me know.. rnI have already placed the 13 sprite files in the dodsprites folder... rnand I do see the plugin running rn(New HeNades Effec 0.1 SAMURAI new_henade_efx. running )... rnSo I think it has to do with the iGren variable below:rnAlso, the last few sprites don't show as it supposed to leave a skeleton sprite behind on the ground.rnrnregards,rnDFHServerrn===============================================================rn/*rn New HeNades Effectsrn Version 0.1 by SAMURAIrn rn * Plugin details:rn- The basic sprite from hegrenade explode was replaced with new 13 spritesrnNew effects, colors, etcrn rn * Required Modules:rn- dodxrn- Fakemetarn * Cvars:rn- Nonern * Admin Commands:rn- NonernrnHave a nice day nowrn*/rn#include <amxmodx>rn#include <amxmisc>rn#include <fakemeta>rn#include <dodx>rn rn#define PLUGIN_NAME "New HeNades Effects"rn#define PLUGIN_VERSION "0.1"rn#define PLUGIN_AUTHOR "SAMURAI"rn rn// required sprites for pluginrnnew const g_sprites[][] =rn{rn "sprites/he_efx1.spr",rn "sprites/he_efx2.spr",rn "sprites/he_efx3.spr",rn "sprites/he_efx4.spr",rn "sprites/he_efx5.spr",rn "sprites/he_efx6.spr",rn "sprites/he_efx7.spr",rn "sprites/he_efx8.spr",rn "sprites/he_efx9.spr",rn "sprites/he_efx10.spr",rn "sprites/he_efx11.spr",rn "sprites/he_efx12.spr",rn "sprites/he_efx13.spr"rn}rnrnnew gSpriteIndex;rn rn/******************************************************************rn********************** AMXMODX PLUGIN *****************************rn******************************************************************/rnpublic plugin_init()rn{rn // Register the pluginrn register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR);rn rn rn // Forward Fakemeta Thinkrn register_forward(FM_Think,"fw_think");rn rn}rnrn// plugin_precache forwardrnpublic plugin_precache()rn{rn rn for(new i = 0; i < sizeof g_sprites; i++)rn gSpriteIndex[i] = engfunc(EngFunc_PrecacheModel,g_sprites[i]);rn rn}rn rn/**************************************rngrenade_throw DODX Forward //rnIt's called when an user throw //rna grenade //rn**************************************/rnpublic grenade_throw(id,iGren,wid)rn{rn rn // check if grenade isn't a HeGrenadern if(wid != DODW_STICKGRENADE || wid != DODW_HANDGRENADE)rn return PLUGIN_CONTINUE;rn rn // check if Grenade entity isn't a valid entityrn if(!pev_valid(iGren))rn return PLUGIN_CONTINUE;rn rn // set a new classname to HeGrenadern set_pev(iGren,pev_classname,"fake_hegren");rn rn // Make it to explode after 1.6 secondsrn set_task(1.6,"gre_explode",iGren);rn rn return PLUGIN_CONTINUE;rn rn}rn rn/*****************************************rnFM Think Fakemeta Forward //rnOn this case, help to stop hegrenade //rnfrom original explosion //rn***************************************/rnpublic fw_think(ent)rn{rn if(!pev_valid(ent))rn return FMRES_IGNORED;rn rn if(!pev(ent,pev_bInDuck))rn return FMRES_IGNORED;rn rn new class[32];rn pev(ent,pev_classname,class,31);rn rn if(equali(class,"fake_hegren"))rn return FMRES_SUPERCEDE;rn rn rn return FMRES_IGNORED;rn rn}rn rn rn/*****************************************rnThis is calle d when hegrenade is //rnexplode with new sprites //rn***************************************/rnpublic gre_explode(ent)rn{rn // check if entity isn't validrn if(!pev_valid(ent))rn return;rn rn // new variable for origin and get origin of entityrn static Float:origin[3];rn pev(ent,pev_origin,origin);rn rn rn message_begin(MSG_BROADCAST,SVC_TEMPENTITY);rn write_byte(TE_EXPLOSION); // TE_EXPLOSIONrn write_coord(floatround(origin[0])); // origin xrn write_coord(floatround(origin[1])); // origin yrn write_coord(floatround(origin[2])); // origin zrn write_short(gSpriteIndex[random(sizeof g_sprites)]); // spritesrn write_byte(40); // scale in 0.1'srn write_byte(30); // frameratern wr ite_byte(TE_EXPLFLAG_NONE); // flagsrn message_end(); // message endrn}

=|[76AD]|= TatsuSaisei
posted here
Posts: 794
Threads: 54
Joined: May 2005
05-17-2007, 09:51 AM #2

I don't know if it was the pasting, the forum itself, or the code was actually this "bad", but I took a copy and checked it for simply syntax errors and such and found a few boo-boos ... I corrected the blatant stuff for you, though I did not test it... also, you want to change the OR on the grenade catch, because technically as it stands in your code above, the function will ALWAYS return unless it is any weapon EXCEPT an AXIS AND an ALLIES grenade, which will be impossible to be "both" ... so change the OR to an AND and try it out...n n

// check if grenade isn't a HeGrenadenif(wid != DODW_STICKGRENADE && wid != DODW_HANDGRENADE)nreturn PLUGIN_CONTINUE;
n n
 n/*nNew HeNades EffectsnVersion 0.1 by SAMURAIn* Plugin details:n- The basic sprite from hegrenade explode was replaced with new 13 spritesnNew effects, colors, etcn* Required Modules:n- dodxn- Fakemetan* Cvars:n- Nonen* Admin Commands:n- NonenHave a nice day nown*/n#include <amxmodx>n#include <amxmisc>n#include <fakemeta>n#include <dodx>n#define PLUGIN_NAME "New HeNades Effects"n#define PLUGIN_VERSION "0.1"n#define PLUGIN_AUTHOR "SAMURAI"n// required sprites for pluginnnew const g_sprites[][] = {n "sprites/he_efx1.spr",n "sprites/he_efx2.spr",n "sprites/he_efx3.spr",n "sprites/he_efx4.spr",n "sprites/he_efx5.spr",n "sprites/he_efx6.spr",n "sprites/he_efx7.spr",n "sprites/he_efx8.spr",n "sprites/he_efx9.spr",n "sprites/he_efx10.spr",n "sprites/he_efx11.spr",n "sprites/he_efx12.spr",n "sprites/he_efx13.spr"n}nnew gSpriteIndex[sizeof g_sprites];npublic plugin_init()n{n // Register the pluginn register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR);n n n // Forward Fakemeta Thinkn register_forward(FM_Think,"fw_think");n n}n// plugin_precache forwardnpublic plugin_precache()n{n n for(new i = 0; i < sizeof g_sprites; i++)n  gSpriteIndex[i] = engfunc(EngFunc_PrecacheModel,g_sprites[i]);n n}npublic grenade_throw(id,iGren,wid)n{n n // check if grenade isn't a HeGrenaden if(wid != DODW_STICKGRENADE && wid != DODW_HANDGRENADE)n  return PLUGIN_CONTINUE;n n // check if Grenade entity isn't a valid entityn if(!pev_valid(iGren))n  return PLUGIN_CONTINUE;n n // set a new classname to HeGrenaden set_pev(iGren,pev_classname,"fake_hegren");n n // Make it to explode after 1.6 secondsn set_task(1.6,"gre_explode",iGren);n n return PLUGIN_CONTINUE;n n}npublic fw_think(ent)n{n if(!pev_valid(ent))n  return FMRES_IGNORED;n n if(!pev(ent,pev_bInDuck))n  return FMRES_IGNORED;n n new class[32];n pev(ent,pev_classname,class,31);n n if(equali(class,"fake_hegren"))n  return FMRES_SUPERCEDE;n n n return FMRES_IGNORED;n n}npublic gre_explode(ent)n{n // check if entity isn't validn if(!pev_valid(ent))n  return;n n // new variable for origin and get origin of entityn static Float:FloatOrigin[3];n pev(ent,pev_origin,FloatOrigin);n n n message_begin(MSG_BROADCAST,SVC_TEMPENTITY);n write_byte(TE_EXPLOSION); // TE_EXPLOSIONn write_coord(floatround(FloatOrigin[0])); // origin xn write_coord(floatround(FloatOrigin[1])); // origin yn write_coord(floatround(FloatOrigin[2])); // origin zn write_short(gSpriteIndex[random(sizeof g_sprites)]); // spritesn write_byte(40); // scale in 0.1'sn write_byte(30); // frameraten write_byte(TE_EXPLFLAG_NONE); // flagsn message_end(); // message endn}n
DFHServer
started this thread
Posts: 16
Threads: 3
Joined: Feb 2005
05-18-2007, 02:35 AM #3

hey thanks tat!rnrnYeah, adding the && that worked! rnAlso added the shreck, piat, and zooka to the list.rnMy brother and I haven't taken any programming in over 15 years.rnSo, we make educated guesses (with help from google search) on how the HL pawn coding works.rncheers!rnDFHServer

Archive › Old Forum Threads › Help › Scripting Help › Converting CS new_henade_efx to DOD
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC