PHP Code:
#include <sourcemod>
#include <sdktools>
#include <store>
#include <zephstocks>
#define STORE_MAX_ITEMS 2048
enum Sound
{
String:szSound[PLATFORM_MAX_PATH],
}
new g_eSounds[STORE_MAX_ITEMS][Sound];
new g_iSounds = 0;
public OnPluginStart()
{
new String:m_szGameDir[32];
GetGameFolderName(m_szGameDir, sizeof(m_szGameDir));
Store_RegisterHandler("death_sound", "path", Sounds_OnMapStart, Sounds_Reset, Sounds_Config, Sounds_Equip, Sounds_Remove, true);
HookEvent("player_death", onPlayerDeath, EventHookMode_Pre);
}
public Sounds_OnMapStart()
{
decl String:tmp[PLATFORM_MAX_PATH];
for(new i=0;i<g_iSounds;++i)
{
strcopy(STRING(tmp), g_eSounds[i][szSound]);
PrecacheSound(tmp[6], true);
Downloader_AddFileToDownloadsTable(g_eSounds[i][szSound]);
}
}
public Sounds_Reset()
{
g_iSounds = 0;
}
public Sounds_Config(&Handle:kv, itemid)
{
Store_SetDataIndex(itemid, g_iSounds);
KvGetString(kv, "path", g_eSounds[g_iSounds][szSound], PLATFORM_MAX_PATH);
if(FileExists(g_eSounds[g_iSounds][szSound], true))
{
++g_iSounds;
return true;
}
return false;
}
public Sounds_Equip(client, id)
{
new m_iData = Store_GetDataIndex(id);
return 1;
}
public Sounds_Remove(client, id)
{
return 0;
}
public Action onPlayerDeath(Handle event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if (client == attacker)
return;
float pos[3];
GetClientAbsOrigin(client, pos);
LoopIngamePlayers(i)
{
ClientCommand(i, "play %s", g_eSounds[m_iData][szSound]);
}
}
Can someone help me complete this? Trying to make kill sound
All Copied from store/sounds.sp