Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.64 KB | None | 0 0
  1. #include <sdktools>
  2.  
  3. #pragma newdecls required
  4. #pragma semicolon 1
  5.  
  6. #define PARTICLE_BLOOD "blood_bleedout"
  7.  
  8. static const char szVocalizes[][] =
  9. {
  10. "sound/player/survivor/voice/Gambler/deathscream03.vcd", //Nick
  11. "sound/player/survivor/voice/Gambler/deathscream04.vcd",
  12. "sound/player/survivor/voice/Gambler/deathscream05.vcd",
  13. "sound/player/survivor/voice/Gambler/deathscream06.vcd",
  14. "sound/player/survivor/voice/mechanic/hurtmajor02.vcd", //Ellis
  15. "sound/player/survivor/voice/mechanic/hurtmajor06.vcd",
  16. "sound/player/survivor/voice/mechanic/defibrillator19.vcd",
  17. "sound/player/survivor/voice/Producer/deathscream01.vcd", //Rochelle
  18. "sound/player/survivor/voice/Producer/deathscream02.vcd",
  19. "sound/player/survivor/voice/Coach/deathscream08.vcd", //Coach
  20. "sound/player/survivor/voice/Coach/deathscream09.vcd",
  21. "sound/player/survivor/voice/Coach/hurtcritical01.vcd",
  22. "sound/player/survivor/voice/Coach/hurtcritical03.vcd",
  23. "sound/player/survivor/voice/Coach/hurtcritical06.vcd",
  24. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream01.vcd", //teengirl //L4D1
  25. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream02.vcd",
  26. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream03.vcd",
  27. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream04.vcd",
  28. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream07.vcd",
  29. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/deathscream09.vcd",
  30. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/exertionmajor01.vcd",
  31. "left4dead2_dlc2/sound/player/survivor/voice/teengirl/exertionminor02.vcd",
  32. "left4dead2_dlc2/sound/player/survivor/voice/namvet/deathscream08.vcd", //Bill
  33. "left4dead2_dlc2/sound/player/survivor/voice/namvet/deathscream07.vcd",
  34. "left4dead2_dlc2/sound/player/survivor/voice/namvet/deathscream02.vcd",
  35. "left4dead2_dlc2/sound/player/survivor/voice/namvet/exertioncritical01.vcd",
  36. "left4dead2_dlc2/sound/player/survivor/voice/namvet/exertioncritical02.vcd",
  37. "left4dead2_dlc2/sound/player/survivor/voice/namvet/exertionmajor01.vcd",
  38. "left4dead2_dlc2/sound/player/survivor/voice/namvet/exertionmajor02.vcd",
  39. "left4dead2_dlc2/sound/player/survivor/voice/manager/deathscream01.vcd", //Louis
  40. "left4dead2_dlc2/sound/player/survivor/voice/manager/deathscream06.vcd",
  41. "left4dead2_dlc2/sound/player/survivor/voice/manager/deathscream08.vcd",
  42. "left4dead2_dlc2/sound/player/survivor/voice/manager/deathscream09.vcd",
  43. "left4dead2_dlc2/sound/player/survivor/voice/manager/deathscream10.vcd",
  44. "left4dead2_dlc2/sound/player/survivor/voice/manager/exertioncritical02.vcd",
  45. "left4dead2_dlc2/sound/player/survivor/voice/manager/exertionmajor01.vcd",
  46. "left4dead2_dlc2/sound/player/survivor/voice/manager/exertionminor03.vcd",
  47. "left4dead2_dlc2/sound/player/survivor/voice/biker/deathscream01.vcd", //Francis
  48. "left4dead2_dlc2/sound/player/survivor/voice/biker/deathscream03.vcd",
  49. "left4dead2_dlc2/sound/player/survivor/voice/biker/deathscream05.vcd",
  50. "left4dead2_dlc2/sound/player/survivor/voice/biker/choke04.vcd",
  51. "left4dead2_dlc2/sound/player/survivor/voice/biker/cough04.vcd",
  52. "left4dead2_dlc2/sound/player/survivor/voice/biker/dying02.vcd",
  53. "left4dead2_dlc2/sound/player/survivor/voice/biker/dying01.vcd",
  54. "left4dead2_dlc2/sound/player/survivor/voice/biker/exertioncritical01.vcd",
  55. "left4dead2_dlc2/sound/player/survivor/voice/biker/exertionmajor01.vcd",
  56. "left4dead2_dlc2/sound/player/survivor/voice/biker/exertioncritical02.vcd",
  57. "left4dead2_dlc2/sound/player/survivor/voice/biker/exertionminor05.vcd"
  58. };
  59.  
  60. bool g_bDie[MAXPLAYERS + 1];
  61. float g_iHelth[MAXPLAYERS + 1];
  62. Handle hTimer[MAXPLAYERS + 1], DoAnimationEvent, Blood;
  63.  
  64. public void OnPluginStart()
  65. {
  66. HookEvent("revive_begin", eBegin);
  67. HookEvent("revive_success", eSuccess);
  68.  
  69. HookEvent("heal_success", eHeal);
  70.  
  71. Handle hGameConf = LoadGameConfigFile("l4d2_sequence");
  72.  
  73. StartPrepSDKCall(SDKCall_Static);
  74. PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CBloodStream");
  75. PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
  76. PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
  77. PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer);
  78. PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer);
  79. Blood = EndPrepSDKCall();
  80.  
  81. StartPrepSDKCall(SDKCall_Player);
  82. PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "CTerrorPlayer::DoAnimationEvent");
  83. PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
  84. PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
  85. DoAnimationEvent = EndPrepSDKCall();
  86.  
  87. delete hGameConf;
  88. }
  89.  
  90. public void OnMapStart()
  91. {
  92. int table = INVALID_STRING_TABLE;
  93.  
  94. if( table == INVALID_STRING_TABLE )
  95. {
  96. table = FindStringTable("ParticleEffectNames");
  97. }
  98.  
  99. if( FindStringIndex(table, PARTICLE_BLOOD) == INVALID_STRING_INDEX )
  100. {
  101. bool save = LockStringTables(false);
  102. AddToStringTable(table, PARTICLE_BLOOD);
  103. LockStringTables(save);
  104. }
  105. }
  106.  
  107. public void eBegin (Event event, const char[] name, bool dontbroadcast)
  108. {
  109. int client = GetClientOfUserId(event.GetInt("subject"));
  110.  
  111. if(!client || !IsClientInGame(client))
  112. return;
  113.  
  114. g_iHelth[client] = GetEntPropFloat(client, Prop_Send, "m_healthBuffer") + GetClientHealth(client);
  115. }
  116.  
  117. public void eSuccess (Event event, const char[] name, bool dontbroadcast)
  118. {
  119. int client = GetClientOfUserId(event.GetInt("subject"));
  120.  
  121. if(!client || !IsClientInGame(client))
  122. return;
  123.  
  124. g_bDie[client] = true;
  125. hTimer[client] = CreateTimer(g_iHelth[client] / 4.6, tToDie, GetClientUserId(client));
  126. CreateTimer(GetRandomFloat(0.0, 12.0), tBleed, GetClientUserId(client), TIMER_REPEAT);
  127. }
  128.  
  129. public void eHeal (Event event, const char[] name, bool dontbroadcast)
  130. {
  131. int client = GetClientOfUserId(event.GetInt("subject"));
  132.  
  133. if(!client || !IsClientInGame(client) || !g_bDie[client])
  134. return;
  135.  
  136. SetEntityHealth(client, 25);
  137. g_bDie[client] = false;
  138.  
  139. if(hTimer[client] != null)
  140. delete hTimer[client];
  141. }
  142.  
  143. public Action tBleed (Handle timer, any client)
  144. {
  145. client = GetClientOfUserId(client);
  146.  
  147. if(!client || !IsClientInGame(client))
  148. return Plugin_Continue;
  149.  
  150. if(!g_bDie[client])
  151. return Plugin_Stop;
  152.  
  153. float vPos[3], vAng[3];
  154.  
  155. GetClientEyePosition(client, vPos);
  156. vAng[0] = 89.00;
  157.  
  158. Handle hTrace = TR_TraceRayFilterEx(vPos, vAng, CONTENTS_SOLID, RayType_Infinite, TraceDontHitSelf, client);
  159.  
  160. if( TR_DidHit(hTrace) )
  161. TR_GetEndPosition(vPos, hTrace);
  162. delete hTrace;
  163.  
  164. int entity = CreateEntityByName("info_particle_system");
  165.  
  166. if(!IsValidEntity(entity))
  167. return Plugin_Continue;
  168.  
  169. DispatchKeyValue(entity, "effect_name", PARTICLE_BLOOD);
  170. TeleportEntity(entity, vPos, NULL_VECTOR, NULL_VECTOR);
  171. DispatchSpawn(entity);
  172. ActivateEntity(entity);
  173.  
  174. AcceptEntityInput(entity, "start");
  175.  
  176. Vocalize(client);
  177.  
  178. GetClientEyePosition(client, vPos);
  179. vPos[2] -= 4.0;
  180. for(int i = 1; i < GetRandomInt(1, 12); i++)
  181. SDKCall(Blood, vPos, vPos, 40, 40);
  182.  
  183. return Plugin_Continue;
  184. }
  185.  
  186. public bool TraceDontHitSelf(int entity, int mask, any data)
  187. {
  188. if(entity == data)
  189. return false;
  190. return true;
  191. }
  192.  
  193. public Action tToDie (Handle timer, any client)
  194. {
  195. client = GetClientOfUserId(client);
  196.  
  197. if(!client || !IsClientInGame(client))
  198. return;
  199.  
  200. SDKCall(DoAnimationEvent, client, 10, 0);
  201. CreateTimer(3.15, tDeath, GetClientUserId(client));
  202. }
  203.  
  204. public Action tDeath (Handle timer, any client)
  205. {
  206. client = GetClientOfUserId(client);
  207.  
  208. if(!client || !IsClientInGame(client))
  209. return;
  210.  
  211. ForcePlayerSuicide(client);
  212. hTimer[client] = null;
  213. g_bDie[client] = false;
  214. }
  215.  
  216. void Vocalize(int client)
  217. {
  218. char sTemp[64];
  219. GetEntPropString(client, Prop_Data, "m_ModelName", sTemp, 64);
  220.  
  221. int random;
  222.  
  223. if( sTemp[26] == 'c' ) // c = Coach
  224. random = GetRandomInt(10, 13);
  225. else if( sTemp[26] == 'g' ) // g = Gambler
  226. random = GetRandomInt(0, 3);
  227. else if( sTemp[26] == 'm' && sTemp[27] == 'e' ) // me = Mechanic
  228. random = GetRandomInt(4, 6);
  229. else if( sTemp[26] == 'p' ) // p = Producer
  230. random = GetRandomInt(7, 8);
  231. else if( sTemp[26] == 'b' ) // b = biker
  232. random = GetRandomInt(37, 47);
  233. else if( sTemp[26] == 'n' ) // n = namvet
  234. random = GetRandomInt(22, 28);
  235. else if( sTemp[26] == 'm' && sTemp[27] == 'a' ) // m = manager
  236. random = GetRandomInt(29, 36);
  237. else if( sTemp[26] == 't' ) // t = teengirl
  238. random = GetRandomInt(14, 21);
  239. else
  240. return;
  241.  
  242. int entity = CreateEntityByName("instanced_scripted_scene");
  243. DispatchKeyValue(entity, "SceneFile", szVocalizes[random]);
  244. DispatchSpawn(entity);
  245. SetEntPropEnt(entity, Prop_Data, "m_hOwner", client);
  246. ActivateEntity(entity);
  247. AcceptEntityInput(entity, "Start", client, client);
  248. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement