Advertisement
Guest User

Untitled

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