Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #pragma semicolon 1
- 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/weapons_ff.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("FireOfExplosive");
- kv.SetFloat("weapon_grenade_launcher/explosive", 1.0);
- kv.ExportToFile(path);
- delete kv;
- }
- public OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public OnClientDisconnect(client)
- {
- SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
- }
- public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
- {
- if (damagetype & DMG_BLAST)
- {
- KeyValues kv = new KeyValues("FireOfExplosive");
- if (kv.ImportFromFile(sDataFilePath))
- {
- float num = KvGetFloat(kv, "explosive", 1.0);
- damage = num;
- 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
Advertisement