Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <l4d2tools>
- static bool:incapped[MAXPLAYERS + 1] = false;
- public Plugin:myinfo =
- {
- name = "[L4D2] Fix L4D1 survivors collapse to incap animations",
- author = "DeathChaos25",
- description = "Fixes male L4D1 survivors having no animation when initially incapped",
- version = "",
- url = ""
- }
- public void OnPluginStart()
- {
- HookEvent("player_incapacitated", Event_Incap);
- }
- public Action:Event_Incap(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if (IsSurvivor(client))
- {
- incapped[client] = true;
- CreateTimer(3.32, SETFALSE, client);
- }
- }
- public Action:SETFALSE(Handle:Timer, client)
- {
- incapped[client] = false;
- }
- public Action:L4D2_OnSelectSequence(client, &sequence)
- {
- if (IsSurvivor(client) && IsPlayerAlive(client) && IsIncapacitated(client) && incapped[client] && !IsPlayerHeld(client))
- {
- new incap = GetIncapSequence(client);
- if (incap != -1)
- {
- sequence = incap;
- return Plugin_Handled;
- }
- }
- return Plugin_Continue;
- }
- bool:IsSurvivor(client)
- {
- return (client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2);
- }
- stock bool:IsPlayerHeld(client)
- {
- new jockey = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker");
- new charger = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker");
- new hunter = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker");
- new smoker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner");
- if (jockey > 0 || charger > 0 || hunter > 0 || smoker > 0)
- {
- return true;
- }
- return false;
- }
- stock bool:IsIncapacitated(client)
- {
- if (GetEntProp(client, Prop_Send, "m_isIncapacitated", 1) > 0)
- return true;
- return false;
- }
- stock GetIncapSequence(client)
- {
- if (IsSurvivor(client))
- {
- decl String:model[64];
- GetEntPropString(client, Prop_Data, "m_ModelName", model, sizeof(model));
- if (StrContains(model, "namvet", false) != -1)
- {
- return 518;
- }
- else if (StrContains(model, "biker", false) != -1)
- {
- return 521;
- }
- else if (StrContains(model, "manager", false) != -1)
- {
- return 518;
- }
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment