Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <l4d2tools>
- public Plugin:myinfo =
- {
- name = "[L4D2] Incap Crawling",
- author = "DeathChaos25",
- description = "",
- version = "",
- url = ""
- }
- public OnPluginStart()
- {
- SetConVarInt(FindConVar("survivor_allow_crawling"), 1);
- SetConVarInt(FindConVar("survivor_crawl_speed"), 35);
- }
- public Action:L4D2_OnSelectSequence(client, &sequence)
- {
- if (IsSurvivor(client) && IsPlayerAlive(client) && !IsPlayerHeld(client)
- && GetEntProp(client, Prop_Send, "m_isHangingFromLedge") != 1
- && GetEntProp(client, Prop_Send, "m_reviveOwner") == -1 && IsIncapacitated(client))
- {
- new crawl = GetCrawlSequence(client);
- new buttons = GetClientButtons(client);
- if (crawl != -1 && buttons & IN_FORWARD)
- {
- sequence = crawl;
- GotoThirdPerson(client);
- SetEntPropVector(client, Prop_Send, "m_angRotation", Angles);
- return Plugin_Handled;
- }
- else GotoFirstPerson(client);
- }
- else if (IsSurvivor(client) && IsPlayerAlive(client) && sequence != GetCrawlSequence(client))
- {
- GotoFirstPerson(client);
- }
- 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;
- }
- GotoThirdPerson(client)
- {
- SetEntPropFloat(client, Prop_Send, "m_TimeForceExternalView", 99999.3);
- }
- GotoFirstPerson(client)
- {
- SetEntPropFloat(client, Prop_Send, "m_TimeForceExternalView", 0.0);
- }
- stock GetCrawlSequence(client)
- {
- if (IsSurvivor(client))
- {
- decl String:model[64];
- GetEntPropString(client, Prop_Data, "m_ModelName", model, sizeof(model));
- if (StrContains(model, "gambler", false) != -1)
- {
- return 631;
- }
- else if (StrContains(model, "producer", false) != -1)
- {
- return 639;
- }
- else if (StrContains(model, "mechanic", false) != -1)
- {
- return 636;
- }
- else if (StrContains(model, "namvet", false) != -1)
- {
- return 539;
- }
- else if (StrContains(model, "teenangst", false) != -1)
- {
- return 529;
- }
- else if (StrContains(model, "biker", false) != -1)
- {
- return 542;
- }
- else if (StrContains(model, "manager", false) != -1)
- {
- return 539;
- }
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement