Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sourcemod>
- #include <sdktools>
- #include sdkhooks
- Handle Blood;
- float vPos[MAXPLAYERS+1][3];
- public void OnPluginStart()
- {
- Handle hGameConf = LoadGameConfigFile("ChooseVictim");
- if( hGameConf == null )
- SetFailState("Couldn't find the offsets and signatures file. Please, check that it is installed correctly.");
- StartPrepSDKCall(SDKCall_Static);
- if( PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "Blood") == false )
- SetFailState("Could not load the \"CPipeBombProjectile_Create\" gamedata signature.");
- 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();
- HookEvent("bullet_impact", EventImpact);
- }
- public Action EventImpact(Handle event, const char[] name, bool dontBroadcast)
- {
- int userid = GetClientOfUserId(GetEventInt(event, "userid"));
- if(bIsSurivor(userid))
- {
- vPos[userid][0] = GetEventFloat(event, "x");
- vPos[userid][1] = GetEventFloat(event, "y");
- vPos[userid][2] = GetEventFloat(event, "z");
- }
- }
- public void OnClientConnected(int client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
- {
- if(bIsSurivor(victim))
- {
- float vStart[3];
- for(int i = 1; i < GetRandomInt(1, 5); i++)
- {
- vStart[0] = vPos[attacker][0] + GetRandomInt(-5, 5);
- vStart[1] = vPos[attacker][1] + GetRandomInt(-5, 5);
- vStart[2] = vPos[attacker][2] + GetRandomInt(-5, 5);
- SDKCall(Blood, vStart, vStart, 40, 40);
- }
- }
- }
- public bool bIsSurivor(int client)
- {
- if (client <= 0)
- return false;
- if (client > MaxClients)
- return false;
- if (!IsClientInGame(client))
- return false;
- if (!IsPlayerAlive(client))
- return false;
- if (GetClientTeam(client) != 2)
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement