Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sdktools>
- #pragma newdecls required
- #pragma semicolon 1
- #define PARTICLE_BLOOD "blood_bleedout"
- static const char szVocalizes[][] =
- {
- "scenes/Gambler/deathscream03.vcd", //Nick
- "scenes/Gambler/deathscream04.vcd",
- "scenes/Gambler/deathscream05.vcd",
- "scenes/Gambler/deathscream06.vcd",
- "scenes/mechanic/hurtmajor02.vcd", //Ellis
- "scenes/mechanic/hurtmajor06.vcd",
- "scenes/mechanic/defibrillator19.vcd",
- "scenes/Producer/deathscream01.vcd", //Rochelle
- "scenes/Producer/deathscream02.vcd",
- "scenes/Coach/deathscream08.vcd", //Coach
- "scenes/Coach/deathscream09.vcd",
- "scenes/Coach/hurtcritical01.vcd",
- "scenes/Coach/hurtcritical03.vcd",
- "scenes/Coach/hurtcritical06.vcd",
- "scenes/teengirl/deathscream01.vcd", //teengirl //L4D1
- "scenes/teengirl/deathscream02.vcd",
- "scenes/teengirl/deathscream03.vcd",
- "scenes/teengirl/deathscream04.vcd",
- "scenes/teengirl/deathscream07.vcd",
- "scenes/teengirl/deathscream09.vcd",
- "scenes/teengirl/exertionmajor01.vcd",
- "scenes/teengirl/exertionminor02.vcd",
- "scenes/namvet/deathscream08.vcd", //Bill
- "scenes/namvet/deathscream07.vcd",
- "scenes/namvet/deathscream02.vcd",
- "scenes/namvet/exertioncritical01.vcd",
- "scenes/namvet/exertioncritical02.vcd",
- "scenes/namvet/exertionmajor01.vcd",
- "scenes/namvet/exertionmajor02.vcd",
- "scenes/manager/deathscream01.vcd", //Louis
- "scenes/manager/deathscream06.vcd",
- "scenes/manager/deathscream08.vcd",
- "scenes/manager/deathscream09.vcd",
- "scenes/manager/deathscream10.vcd",
- "scenes/manager/exertioncritical02.vcd",
- "scenes/manager/exertionmajor01.vcd",
- "scenes/manager/exertionminor03.vcd",
- "scenes/biker/deathscream01.vcd", //Francis
- "scenes/biker/deathscream03.vcd",
- "scenes/biker/deathscream05.vcd",
- "scenes/biker/choke04.vcd",
- "scenes/biker/cough04.vcd",
- "scenes/biker/dying02.vcd",
- "scenes/biker/dying01.vcd",
- "scenes/biker/exertioncritical01.vcd",
- "scenes/biker/exertionmajor01.vcd",
- "scenes/biker/exertioncritical02.vcd",
- "scenes/biker/exertionminor05.vcd"
- };
- bool g_bDie[MAXPLAYERS + 1];
- float g_iHelth[MAXPLAYERS + 1];
- Handle hTimer[MAXPLAYERS + 1], DoAnimationEvent, Blood;
- public void OnPluginStart()
- {
- HookEvent("revive_begin", eBegin);
- HookEvent("revive_success", eSuccess);
- HookEvent("player_death", eDeath);
- HookEvent("heal_success", eHeal);
- Handle hGameConf = LoadGameConfigFile("added_inkap-deadly");
- StartPrepSDKCall(SDKCall_Static);
- PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CBloodStream");
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer);
- PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer);
- Blood = EndPrepSDKCall();
- StartPrepSDKCall(SDKCall_Player);
- PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "CTerrorPlayer::DoAnimationEvent");
- PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
- PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
- DoAnimationEvent = EndPrepSDKCall();
- delete hGameConf;
- }
- public void OnMapStart()
- {
- int table = INVALID_STRING_TABLE;
- if( table == INVALID_STRING_TABLE )
- {
- table = FindStringTable("ParticleEffectNames");
- }
- if( FindStringIndex(table, PARTICLE_BLOOD) == INVALID_STRING_INDEX )
- {
- bool save = LockStringTables(false);
- AddToStringTable(table, PARTICLE_BLOOD);
- LockStringTables(save);
- }
- }
- public void eDeath (Event event, const char[] name, bool dontbroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- if(!client || !IsClientInGame(client))
- return;
- g_bDie[client] = false;
- }
- public void eBegin (Event event, const char[] name, bool dontbroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("subject"));
- if(!client || !IsClientInGame(client))
- return;
- g_iHelth[client] = GetEntPropFloat(client, Prop_Send, "m_healthBuffer") + GetClientHealth(client);
- }
- public void eSuccess (Event event, const char[] name, bool dontbroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("subject"));
- if(!client || !IsClientInGame(client))
- return;
- g_bDie[client] = true;
- hTimer[client] = CreateTimer(g_iHelth[client] / 6, tToDie, GetClientUserId(client));
- CreateTimer(GetRandomFloat(0.0, 12.0), tBleed, GetClientUserId(client), TIMER_REPEAT);
- }
- public void eHeal (Event event, const char[] name, bool dontbroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("subject"));
- if(!client || !IsClientInGame(client) || !g_bDie[client])
- return;
- SetEntityHealth(client, 25);
- g_bDie[client] = false;
- if(hTimer[client] != null)
- delete hTimer[client];
- }
- public Action tBleed (Handle timer, any client)
- {
- client = GetClientOfUserId(client);
- if(!client || !IsClientInGame(client))
- return Plugin_Continue;
- if(!g_bDie[client])
- return Plugin_Stop;
- float vPos[3], vAng[3];
- GetClientEyePosition(client, vPos);
- vAng[0] = 89.00;
- Handle hTrace = TR_TraceRayFilterEx(vPos, vAng, CONTENTS_SOLID, RayType_Infinite, TraceDontHitSelf, client);
- if( TR_DidHit(hTrace) )
- TR_GetEndPosition(vPos, hTrace);
- delete hTrace;
- int entity = CreateEntityByName("info_particle_system");
- if(!IsValidEntity(entity))
- return Plugin_Continue;
- DispatchKeyValue(entity, "effect_name", PARTICLE_BLOOD);
- TeleportEntity(entity, vPos, NULL_VECTOR, NULL_VECTOR);
- DispatchSpawn(entity);
- ActivateEntity(entity);
- AcceptEntityInput(entity, "start");
- Vocalize(client);
- GetClientEyePosition(client, vPos);
- vPos[2] -= 4.0;
- for(int i = 1; i < GetRandomInt(1, 12); i++)
- SDKCall(Blood, vPos, vPos, 40, 40);
- return Plugin_Continue;
- }
- public bool TraceDontHitSelf(int entity, int mask, any data)
- {
- if(entity == data)
- return false;
- return true;
- }
- public Action tToDie (Handle timer, any client)
- {
- client = GetClientOfUserId(client);
- if(!client || !IsClientInGame(client) || !g_bDie[client])
- return;
- SDKCall(DoAnimationEvent, client, 10, 0);
- CreateTimer(3.15, tDeath, GetClientUserId(client));
- }
- public Action tDeath (Handle timer, any client)
- {
- client = GetClientOfUserId(client);
- if(!client || !IsClientInGame(client))
- return;
- ForcePlayerSuicide(client);
- hTimer[client] = null;
- g_bDie[client] = false;
- }
- void Vocalize(int client)
- {
- char sTemp[64];
- GetEntPropString(client, Prop_Data, "m_ModelName", sTemp, 64);
- int random;
- if( sTemp[26] == 'c' ) // c = Coach
- random = GetRandomInt(10, 13);
- else if( sTemp[26] == 'g' ) // g = Gambler
- random = GetRandomInt(0, 3);
- else if( sTemp[26] == 'm' && sTemp[27] == 'e' ) // me = Mechanic
- random = GetRandomInt(4, 6);
- else if( sTemp[26] == 'p' ) // p = Producer
- random = GetRandomInt(7, 8);
- else if( sTemp[26] == 'b' ) // b = biker
- random = GetRandomInt(37, 47);
- else if( sTemp[26] == 'n' ) // n = namvet
- random = GetRandomInt(22, 28);
- else if( sTemp[26] == 'm' && sTemp[27] == 'a' ) // m = manager
- random = GetRandomInt(29, 36);
- else if( sTemp[26] == 't' ) // t = teengirl
- random = GetRandomInt(14, 21);
- else
- return;
- int entity = CreateEntityByName("instanced_scripted_scene");
- DispatchKeyValue(entity, "SceneFile", szVocalizes[random]);
- DispatchSpawn(entity);
- SetEntPropEnt(entity, Prop_Data, "m_hOwner", client);
- ActivateEntity(entity);
- AcceptEntityInput(entity, "Start", client, client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement