Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sdktools>
- #include <sdkhooks>
- #pragma newdecls required
- #pragma semicolon 1
- #pragma tabsize 0
- bool lateLoad;
- int AutoShot = 21;
- int Pistol = 40;
- int Spas = 26;
- int Smg = 46;
- int Silenced = 42;
- int SSG = 46;
- int Pumpshotgun = 28;
- int Chrome = 36;
- public APLRes AskPluginLoad2(Handle plugin, bool late, char[] erro, int errMax)
- {
- lateLoad = late;
- return APLRes_Success;
- }
- public void OnPluginStart()
- {
- if (lateLoad)
- {
- for (int client = 1; client <= MaxClients; client++)
- {
- if (IsClientInGame(client))
- {
- OnClientPutInServer(client);
- }
- }
- }
- }
- public void OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_TraceAttack, OnTakeDamage);
- }
- public void OnClientDisconnect(int client)
- {
- SDKUnhook(client, SDKHook_TraceAttack, OnTakeDamage);
- }
- public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
- {
- if (!(damagetype & DMG_BURN && damagetype & DMG_BLAST))
- {
- if (IsValidClient(attacker) && GetClientTeam(attacker) == 2)
- {
- if(IsValidClient(victim) && GetClientTeam(victim) == 2)
- {
- if(hitgroup != 3) return Plugin_Continue;
- int iEnt = GetEntPropEnt(attacker, Prop_Send, "m_hUseEntity");
- if(IsValidEdict(iEnt) && iEnt > 0)
- {
- char sWeaponEx[32];
- GetEdictClassname(iEnt, sWeaponEx, sizeof(sWeaponEx));
- if (StrEqual(sWeaponEx, "prop_minigun") || StrEqual(sWeaponEx, "prop_minigun_l4d1")) return Plugin_Continue;
- }
- char classname[64];
- GetClientWeapon(attacker, classname, sizeof(classname));
- if(StrEqual(classname, "weapon_melee")) return Plugin_Continue;
- if(StrEqual(classname, "weapon_autoshotgun"))
- {
- ForceDamageEntity(attacker, AutoShot, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_hunting_rifle"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_rifle"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_pistol"))
- {
- ForceDamageEntity(attacker, Pistol, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_pistol_magnum"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_pumpshotgun"))
- {
- ForceDamageEntity(attacker, Pumpshotgun, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_rifle_ak47"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_rifle_desert"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_rifle_m60"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_rifle_sg552"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_shotgun_chrome"))
- {
- ForceDamageEntity(attacker, Chrome, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_shotgun_spas"))
- {
- ForceDamageEntity(attacker, Spas, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_smg"))
- {
- ForceDamageEntity(attacker, Smg, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_smg_mp5"))
- {
- ForceDamageEntity(attacker, SSG, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_smg_silenced"))
- {
- ForceDamageEntity(attacker, Silenced, victim);
- damage = 0.0;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "weapon_sniper_awp"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_sniper_scout"))
- {
- ForcePlayerSuicide(victim);
- }
- else if(StrEqual(classname, "weapon_sniper_military"))
- {
- ForcePlayerSuicide(victim);
- }
- }
- }
- }
- return Plugin_Continue;
- }
- public bool IsValidClient(int client)
- {
- if (client <= 0)
- return false;
- if (client > MaxClients)
- return false;
- if (!IsClientInGame(client))
- return false;
- if (!IsPlayerAlive(client))
- return false;
- return true;
- }
- stock void ForceDamageEntity(int causer, int damage, int victim) // thanks to 达斯*维达
- {
- float victim_origin[3];
- char rupture[32];
- char damage_victim[32];
- IntToString(damage, rupture, sizeof(rupture));
- Format(damage_victim, sizeof(damage_victim), "hurtme%d", victim);
- GetEntPropVector(victim, Prop_Send, "m_vecOrigin", victim_origin);
- int entity = CreateEntityByName("point_hurt");
- DispatchKeyValue(victim, "targetname", damage_victim);
- DispatchKeyValue(entity, "DamageTarget", damage_victim);
- DispatchKeyValue(entity, "Damage", rupture);
- DispatchSpawn(entity);
- TeleportEntity(entity, victim_origin, NULL_VECTOR, NULL_VECTOR);
- AcceptEntityInput(entity, "Hurt", (causer > 0 && causer <= MaxClients) ? causer : -1);
- DispatchKeyValue(entity, "classname", "point_hurt");
- DispatchKeyValue(victim, "targetname", "null");
- AcceptEntityInput(entity, "Kill");
- }
Advertisement
Add Comment
Please, Sign In to add comment