Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- int tank;
- Handle sdkOnStaggered;
- Handle distance;
- public OnPluginStart()
- {
- distance = CreateConVar("sv_rang_rock_stun", "400.0", "", FCVAR_NONE);
- Handle hGameConf = LoadGameConfigFile("tank_stun_rock");
- StartPrepSDKCall(SDKCall_Player);
- PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CTerrorPlayer_OnStaggered");
- PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- sdkOnStaggered = EndPrepSDKCall();
- if(sdkOnStaggered == INVALID_HANDLE)
- {
- SetFailState("Unable to find the 'CTerrorPlayer_Fling' signature, check the file version!");
- }
- HookEvent("ability_use", ability_use);
- }
- public Action ability_use(Event event, const char[] name, bool dontBroadcast)
- {
- decl String:s[32];
- GetEventString(event, "ability", s, 32);
- if(StrEqual(s, "ability_throw", true))
- {
- tank = GetClientOfUserId(GetEventInt(event, "userid"));
- }
- }
- public OnEntityCreated(entity, const String:classname[])
- {
- if(StrEqual(classname, "tank_rock", true) && GetEntProp(entity, Prop_Send, "m_iTeamNum")>=0)
- {
- if(IsValidEntity(entity) && IsValidEdict(entity))
- {
- if(GetEntityFlags(tank) & FL_ONFIRE)
- {
- IgniteEntity(entity, 30.0);
- }
- }
- }
- }
- public OnEntityDestroyed(entity)
- {
- if(IsValidEntity(entity) && IsValidEdict(entity))
- {
- decl String:g_classname[20];
- GetEdictClassname(entity, g_classname, 20);
- if(StrEqual(g_classname, "tank_rock", true) && GetEntProp(entity, Prop_Send, "m_iTeamNum")>=0)
- {
- for(int i = 1; i <= MaxClients; ++i)
- {
- if(bIsSurvivor(i))
- {
- float fDamagerPos[3], fDangerPos[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fDamagerPos);
- GetEntPropVector(i, Prop_Send, "m_vecOrigin", fDangerPos);
- float fTargetDistance = GetVectorDistance(fDamagerPos, fDangerPos);
- if (fTargetDistance > GetConVarFloat(distance)) continue;
- SDKCall(sdkOnStaggered, i, entity, fDamagerPos);
- }
- }
- }
- }
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment