Plugin c4 w [NOWE] Pluginy Opublikowano Czerwiec 4, 2020 o 15:19 #include <sourcemod> #include <sdktools> ConVar g_c4Timer; ConVar g_SoundName; ConVar g_SoundVolume; float c4Timer; float Tick = 0.0; char SoundName[256]; public OnPluginStart() { g_SoundName = CreateConVar("sm_bomb_sound_name", "nazwa_piosenki.mp3", "Nazwa pliku .mp3/.wav"); g_SoundVolume = CreateConVar("sm_bomb_sound_volume", "0.05", "Głośnośc piosenki"); HookEvent("bomb_planted", Bomb_Planted); AutoExecConfig(true, "bomb_sound"); } public Action Bomb_Planted(Event e, const char[] name, bool broadCast) { g_c4Timer = FindConVar("mp_c4timer"); c4Timer = GetConVarFloat(g_c4Timer); Tick = 0.0; CreateTimer(1.0, BombTick, _, TIMER_REPEAT); } public Action BombTick(Handle timer) { Tick++; float TimeToExplose = c4Timer - Tick; if (TimeToExplose == 10.0) EmitSoundToAll(SoundName, _, _, _, _, GetConVarFloat(g_SoundVolume), _, _, _, _, _, _); else { if (TimeToExplose <= 0) { for (int i = 1; i <= MaxClients; i++) StopSound(i, SNDCHAN_AUTO, SoundName); KillTimer(timer); } } } public OnClientConnected(int client) { PrecacheFix(); } void PrecacheFix() { GetConVarString(g_SoundName, SoundName, sizeof(SoundName)); Format(SoundName, sizeof(SoundName), "sound/%s", SoundName); AddFileToDownloadsTable(SoundName); GetConVarString(g_SoundName, SoundName, sizeof(SoundName)); Format(SoundName, sizeof(SoundName), "*/%s", SoundName); PrecacheSound(SoundName); } bomb_sound.smx
Plugin c4
w [NOWE] Pluginy
Opublikowano
bomb_sound.smx