查看: 5320|回复: 29

[有源码] 终极暴血插件

[复制链接]
发表于 2012-7-18 07:10:57 | 显示全部楼层 |阅读模式
#define GIBS_ENABLED
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <dodconst>
#include <tfcconst>
#include <tsconst>
//Auto-load the correct module if not loaded
#pragma reqclass xstats
#if !defined AMXMODX_NOAUTOLOAD
#pragma defclasslib xstats csx
#pragma defclasslib xstats dodx
#pragma defclasslib xstats tfcx
#pragma defclasslib xstats tsx
#endif
#define MAX_PLAYERS 32
#define MAX_HOSTAGES 16
#define GORE_HEADSHOT (1<<0) // "a"
#define GORE_BLOOD (1<<1) // "b"
#define GORE_BLEEDING (1<<2) // "c"
#define GORE_GIB (1<<3) // "d"
#define GORE_EXTRA (1<<4) // "e"
#define GORE_EXTRA_HS (1<<5) // "f"
#define GORE_HOSTAGES (1<<6) // "g"
#define BLOOD_COLOR_RED 247
#define BLOOD_COLOR_YELLOW 195
#define BLOOD_STREAM_RED 70
#define BLOOD_STREAM_YELLOW 60
new gHealthIndex[MAX_PLAYERS+1]
new Float:hostage_hp[MAX_HOSTAGES], hostages[MAX_HOSTAGES], host_num
#if defined GIBS_ENABLED
new mdl_gib_flesh, mdl_gib_head, mdl_gib_legbone
new mdl_gib_lung, mdl_gib_meat, mdl_gib_spine
#endif
new spr_blood_drop, spr_blood_spray
#define BLOOD_SM_NUM 8
#define BLOOD_LG_NUM 2
new blood_small_red[BLOOD_SM_NUM], blood_large_red[BLOOD_LG_NUM]
//new blood_small_yellow[BLOOD_SM_NUM], blood_large_yellow[BLOOD_LG_NUM]
new mod_name[32], bool:body_hidden[33]
new pcvar_gore, pcvar_gore_exphp
//Offsets to place blood is more realistic hit location
new Offset[8][3] = {{0,0,10},{0,0,30},{0,0,16},{0,0,10},{4,4,16},{-4,-4,16},{4,4,-12},{-4,-4,-12}}
// #####################################################################
// ## Change which weapons cause GIB explosions on death HERE ##
// #####################################################################
new blood_small_name[][] = {"{blood1","{blood2","{blood3","{blood4","{blood5","{blood6","{blood7","{blood8"}
new blood_small_id[sizeof blood_small_name]
new blood_big_name[][] = {"{bigblood1","{bigblood2"}
new blood_big_id[sizeof blood_big_name]
new large_id,small_id
public gib_wpncheck(iWeapon)
{
//This section is used for CS/CZ
if (cstrike_running()) {
switch (iWeapon) {
case CSW_P228 : return false
case CSW_SCOUT : return false
case CSW_HEGRENADE : return true
case CSW_XM1014 : return false
case CSW_C4 : return true
case CSW_MAC10 : return false
case CSW_AUG : return false
case CSW_SMOKEGRENADE : return true
case CSW_ELITE : return false
case CSW_FIVESEVEN : return false
case CSW_UMP45 : return false
case CSW_SG550 : return false
case CSW_GALIL : return false
case CSW_FAMAS : return false
case CSW_USP : return false
case CSW_GLOCK18 : return false
case CSW_AWP : return false
case CSW_MP5NAVY : return false
case CSW_M249 : return false
case CSW_M3 : return false
case CSW_M4A1 : return false
case CSW_TMP : return false
case CSW_G3SG1 : return false
case CSW_FLASHBANG : return true
case CSW_DEAGLE : return false
case CSW_SG552 : return false
case CSW_AK47 : return false
case CSW_KNIFE : return false
case CSW_P90 : return false
}
}
//This section is used for DoD
else if (equali(mod_name,"dod")) {
switch (iWeapon) {
case DODW_AMERKNIFE : return false
case DODW_GERKNIFE : return false
case DODW_COLT : return false
case DODW_LUGER : return false
case DODW_GARAND : return false
case DODW_SCOPED_KAR : return false
case DODW_THOMPSON : return false
case DODW_STG44 : return false
case DODW_SPRINGFIELD : return false
case DODW_KAR : return false
case DODW_BAR : return false
case DODW_MP40 : return false
case DODW_HANDGRENADE : return true
case DODW_STICKGRENADE : return true
case DODW_STICKGRENADE_EX : return true
case DODW_HANDGRENADE_EX : return true
case DODW_MG42 : return false
case DODW_30_CAL : return false
case DODW_SPADE : return false
case DODW_M1_CARBINE : return false
case DODW_MG34 : return false
case DODW_GREASEGUN : return false
case DODW_FG42 : return false
case DODW_K43 : return false
case DODW_ENFIELD : return false
case DODW_STEN : return false
case DODW_BREN : return false
case DODW_WEBLEY : return false
case DODW_BAZOOKA : return true
case DODW_PANZERSCHRECK : return false
case DODW_PIAT : return false
case DODW_SCOPED_FG42 : return false
case DODW_FOLDING_CARBINE : return false
case DODW_KAR_BAYONET : return false
case DODW_SCOPED_ENFIELD : return false
case DODW_MILLS_BOMB : return true
case DODW_BRITKNIFE : return false
case DODW_GARAND_BUTT : return false
case DODW_ENFIELD_BAYONET : return false
case DODW_MORTAR : return false
case DODW_K43_BUTT : return false
}
}
//This section is used for TFC
else if (equali(mod_name,"tfc")) {
switch (iWeapon) {
case TFC_WPN_NONE : return false
case TFC_WPN_TIMER : return false
case TFC_WPN_SENTRYGUN : return false
case TFC_WPN_MEDIKIT : return false
case TFC_WPN_SPANNER : return false
case TFC_WPN_AXE : return false
case TFC_WPN_SNIPERRIFLE : return false
case TFC_WPN_AUTORIFLE : return false
case TFC_WPN_SHOTGUN : return false
case TFC_WPN_SUPERSHOTGUN : return false
case TFC_WPN_NG : return false
case TFC_WPN_SUPERNG : return false
case TFC_WPN_GL : return false
case TFC_WPN_FLAMETHROWER : return false
case TFC_WPN_RPG : return true
case TFC_WPN_IC : return false
case TFC_WPN_FLAMES : return false
case TFC_WPN_AC : return false
case TFC_WPN_UNK18 : return false
case TFC_WPN_UNK19 : return false
case TFC_WPN_TRANQ : return false
case TFC_WPN_RAILGUN : return false
case TFC_WPN_PL : return false
case TFC_WPN_KNIFE : return false
case TFC_WPN_CALTROP : return false
case TFC_WPN_CONCUSSIONGRENADE : return true
case TFC_WPN_NORMALGRENADE : return true
case TFC_WPN_NAILGRENADE : return true
case TFC_WPN_MIRVGRENADE : return true
case TFC_WPN_NAPALMGRENADE : return true
case TFC_WPN_GASGRENADE : return false
case TFC_WPN_EMPGRENADE : return false
}
}
//This section is used for TS
else if (equali(mod_name,"ts")) {
switch (iWeapon) {
case TSW_GLOCK18 : return false
case TSW_UNK1 : return false
case TSW_UZI : return false
case TSW_M3 : return false
case TSW_M4A1 : return false
case TSW_MP5SD : return false
case TSW_MP5K : return false
case TSW_ABERETTAS : return false
case TSW_MK23 : return false
case TSW_AMK23 : return false
case TSW_USAS : return false
case TSW_DEAGLE : return false
case TSW_AK47 : return false
case TSW_57 : return false
case TSW_AUG : return false
case TSW_AUZI : return false
case TSW_TMP : return false
case TSW_M82A1 : return false
case TSW_MP7 : return false
case TSW_SPAS : return false
case TSW_GCOLTS : return false
case TSW_GLOCK20 : return false
case TSW_UMP : return false
case TSW_M61GRENADE : return true
case TSW_CKNIFE : return false
case TSW_MOSSBERG : return false
case TSW_M16A4 : return false
case TSW_MK1 : return false
case TSW_C4 : return true
case TSW_A57 : return false
case TSW_RBULL : return false
case TSW_M60E3 : return false
case TSW_SAWED_OFF : return true
case TSW_KATANA : return false
case TSW_SKNIFE : return false
case TSW_KUNG_FU : return false
case TSW_TKNIFE : return false
}
}
//This section is used for ESF
else if (equali(mod_name,"esf")) {
//Always do GIB explosions on ESF
return true
}
//This section is used for the "valve" mod
else if (equali(mod_name,"valve")) {
switch (iWeapon) {
case HLW_NONE : return false
case HLW_CROWBAR : return false
case HLW_GLOCK : return false
case HLW_PYTHON : return false
case HLW_MP5 : return false
case HLW_CHAINGUN : return false
case HLW_CROSSBOW : return false
case HLW_SHOTGUN : return false
case HLW_RPG : return true
case HLW_GAUSS : return false
case HLW_EGON : return false
case HLW_HORNETGUN : return false
case HLW_HANDGRENADE : return true
case HLW_TRIPMINE : return true
case HLW_SATCHEL : return true
case HLW_SNARK : return false
}
}
//Always false on Sven Co-op
return false
}

修正:
贴图precache后ID>255时贴的图张冠李戴

改进:
按照血迹的名称寻找其precache后的ID

应该是全MOD通用的
具体使用见源码注释或作者原贴(参考1)

参考:
1。原作者的Ultimate Gore暴血插件
http://forums.alliedmods.net/showthread.php?p=19346
2。AMXX message_const.inc
TE_WORLDDECAL、TE_WORLDDECALHIGH消息
3。YaPB源码support.cpp


void DecalTrace (entvars_t *pev, TraceResult *pTrace, char *szDecalName)
{
   int iEntIndex = -1, iMessage = TE_DECAL, iDecalIndex = -1;

   iDecalIndex = (*g_engfuncs.pfnDecalIndex) (szDecalName);//此处用名称寻找贴图ID

   if (iDecalIndex < 0)
      iDecalIndex = (*g_engfuncs.pfnDecalIndex) ("{lambda06");

   if (pTrace->flFraction == 1.0)
      return;

   if (!FNullEnt (pTrace->pHit))
   {
      if ((pTrace->pHit->v.solid == SOLID_BSP) || (pTrace->pHit->v.movetype == MOVETYPE_PUSHSTEP))
         iEntIndex = ENTINDEX (pTrace->pHit);
      else
         return;
   }
   else
      iEntIndex = 0;

   if (iEntIndex != 0)
   {
      if (iDecalIndex > 255)
      {
         iMessage = TE_DECALHIGH;//ID>255时要用TE_DECALHIGH
         iDecalIndex -= 256;
      }
   }
   else
   {
      iMessage = TE_WORLDDECAL;

      if (iDecalIndex > 255)
      {
         iMessage = TE_WORLDDECALHIGH;//ID>255时要用TE_WORLDDECALHIGH
         iDecalIndex -= 256;
      }
   }

   if (IsNullString (strstr (szDecalName, "{")))
   {
      MESSAGE_BEGIN (MSG_BROADCAST, SVC_TEMPENTITY);
         WRITE_BYTE (TE_PLAYERDECAL);
         WRITE_BYTE (ENTINDEX (ENT (pev)));
         WRITE_COORD (pTrace->vecEndPos.x);
         WRITE_COORD (pTrace->vecEndPos.y);
         WRITE_COORD (pTrace->vecEndPos.z);
         WRITE_SHORT (static_cast <short> (ENTINDEX (pTrace->pHit)));
         WRITE_BYTE (iDecalIndex);
      MESSAGE_END ();
   }
   else
   {
      MESSAGE_BEGIN (MSG_BROADCAST, SVC_TEMPENTITY);
         WRITE_BYTE (iMessage);
         WRITE_COORD (pTrace->vecEndPos.x);
         WRITE_COORD (pTrace->vecEndPos.y);
         WRITE_COORD (pTrace->vecEndPos.z);
         WRITE_BYTE (iDecalIndex);

      if (iEntIndex)
         WRITE_SHORT (iEntIndex);
      MESSAGE_END();
   }
}





amx_gore_ultimate.sma

42.22 KB, 下载次数: 18

售价: 3 金钱  [记录]

xx123 该用户已被删除
发表于 2012-7-19 04:12:18 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2012-7-25 00:28:12 | 显示全部楼层
楼上的稍等啦  
7299189 该用户已被删除
发表于 2012-7-27 13:39:36 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2012-7-28 00:16:34 | 显示全部楼层
希望大家都有好运  
发表于 2012-7-28 19:59:01 | 显示全部楼层
今天无聊来逛逛  
发表于 2012-7-29 20:03:00 | 显示全部楼层
加油啊!偶一定会追随你左右,偶坚定此贴必然会起到抛砖引玉的作用~  
发表于 2013-3-10 17:11:14 | 显示全部楼层
说的话就卡的哈加快速度
发表于 2013-4-1 18:27:19 | 显示全部楼层
给力!!!!!!!!!!!
发表于 2013-4-7 23:35:00 | 显示全部楼层
好东西,必顶
您需要登录后才可以回帖 登录 | 中文注册

本版积分规则