Advertisement
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;
- float ForAllMelees = 5.0;
- float KatanaAndTopor = 50.0;
- float CrowbarAndMachete = 10.0;
- float knife = 1.0;
- 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))
- {
- if(IsValidClient(victim))
- {
- char classname[64];
- GetClientWeapon(attacker, classname, sizeof(classname));
- if(StrEqual(classname, "weapon_melee"))
- {
- GetEntPropString(GetPlayerWeaponSlot(attacker, 1), Prop_Data, "m_strMapSetScriptName", classname, sizeof(classname));
- }
- int vClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
- switch(vClass)
- {
- case 9:
- {
- if(StrEqual(classname, "knife"))
- {
- damage = knife;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "katana") || StrEqual(classname, "fireaxe"))
- {
- damage = KatanaAndTopor;
- return Plugin_Changed;
- }
- else if(StrEqual(classname, "machete") || StrEqual(classname, "crowbar"))
- {
- damage = CrowbarAndMachete;
- return Plugin_Changed;
- }
- else
- {
- damage = ForAllMelees;
- return Plugin_Changed;
- }
- }
- }
- }
- }
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement