Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- 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();
- }
- 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