Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #pragma semicolon 1
- #define ZOMBIECLASS_SMOKER 1
- #define ZOMBIECLASS_BOOMER 2
- #define ZOMBIECLASS_HUNTER 3
- #define ZOMBIECLASS_SPITTER 4
- #define ZOMBIECLASS_JOCKEY 5
- #define ZOMBIECLASS_CHARGER 6
- #define ZOMBIECLASS_WITCH 7
- #define ZOMBIECLASS_TANK 8
- new bool:lateLoad;
- char sDataFilePath[PLATFORM_MAX_PATH];
- public APLRes:AskPluginLoad2(Handle:plugin, bool:late, String:error[], errMax)
- {
- lateLoad = late;
- return APLRes_Success;
- }
- public OnPluginStart()
- {
- if (lateLoad)
- {
- for (new client = 1; client <= MaxClients; client++)
- {
- if (IsClientInGame(client))
- {
- OnClientPutInServer(client);
- }
- }
- }
- BuildPath(Path_SM, sDataFilePath, sizeof(sDataFilePath), "data/melee_damage.ini");
- if (!FileExists(sDataFilePath))
- {
- new Handle:open_path = OpenFile(sDataFilePath, "w");
- WriteFileLine(open_path, "");
- CloseHandle(open_path);
- PrintToServer("Error Code: WSP-EC-01A");
- KvWriteToFile(sDataFilePath);
- }
- }
- void KvWriteToFile(const char[] path)
- {
- KeyValues kv = new KeyValues("damage_melee");
- kv.SetNum("ZOMBIECLASS_SMOKER/damage", 1);
- kv.SetNum("ZOMBIECLASS_BOOMER/damage", 1);
- kv.SetNum("ZOMBIECLASS_HUNTER/damage", 1);
- kv.SetNum("ZOMBIECLASS_SPITTER/damage", 1);
- kv.SetNum("ZOMBIECLASS_JOCKEY/damage", 1);
- kv.SetNum("ZOMBIECLASS_CHARGER/damage", 1);
- kv.SetNum("ZOMBIECLASS_TANK/damage", 1);
- kv.ExportToFile(path);
- delete kv;
- }
- public OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_TraceAttack, _SI_OnTraceAttack);
- }
- public OnClientDisconnect(client)
- {
- SDKUnhook(client, SDKHook_TraceAttack, _SI_OnTraceAttack);
- }
- public Action:_SI_OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup)
- {
- decl String:clsname[64];
- GetEdictClassname(inflictor, clsname, 64);
- if (StrEqual(clsname, "weapon_melee"))
- {
- KeyValues kv = new KeyValues("damage_melee");
- if (kv.ImportFromFile(sDataFilePath))
- {
- new num = KvGetNum(kv, "damage", 1);
- if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 1)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_SMOKER", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Smoker=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 2)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_BOOMER", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Boomer=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 3)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_HUNTER", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Hunter=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 4)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_SPITTER", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Spitter=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 5)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_JOCKEY", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Jockey=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 6)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_CHARGER", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Charger=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 7)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_WITCH", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Witch=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- else if(GetEntProp(victim, Prop_Send, "m_zombieClass") == 8)
- {
- if (KvJumpToKey(kv, "ZOMBIECLASS_TANK", true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Tank=%i", heal);
- damage += (damage * 0) + num;
- }
- }
- }
- }
- return Plugin_Continue;
- }
- /*
- public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
- {
- if (!(damagetype & DMG_BURN))
- {
- if (IsValidCharger(victim))
- {
- KeyValues kv = new KeyValues("damage_modifier");
- if (kv.ImportFromFile(sDataFilePath))
- {
- decl String:classname[64];
- GetClientWeapon(attacker, classname, sizeof(classname));
- if (KvJumpToKey(kv, classname, true))
- {
- int heal = GetClientHealth(victim);
- PrintToChatAll("Charger=%i", heal);
- return Plugin_Changed;
- }
- }
- }
- }
- return Plugin_Continue;
- }
- */
- public IsValidClient(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