mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 02:33:21 +00:00
Add 'direct' parameter to L4D2Tools
This commit is contained in:
parent
2874b2c285
commit
93034fa2ef
2 changed files with 16 additions and 3 deletions
Binary file not shown.
|
@ -155,9 +155,10 @@ public Action Command_PlaySound(int client, int args) {
|
||||||
if(args < 2) {
|
if(args < 2) {
|
||||||
ReplyToCommand(client, "Usage: sm_playsound <player> <soundpath>");
|
ReplyToCommand(client, "Usage: sm_playsound <player> <soundpath>");
|
||||||
}else{
|
}else{
|
||||||
char arg1[32], arg2[64];
|
char arg1[32], arg2[64], arg3[16];
|
||||||
GetCmdArg(1, arg1, sizeof(arg1));
|
GetCmdArg(1, arg1, sizeof(arg1));
|
||||||
GetCmdArg(2, arg2, sizeof(arg2));
|
GetCmdArg(2, arg2, sizeof(arg2));
|
||||||
|
GetCmdArg(3, arg3, sizeof(arg3));
|
||||||
|
|
||||||
char target_name[MAX_TARGET_LENGTH];
|
char target_name[MAX_TARGET_LENGTH];
|
||||||
int target_list[MAXPLAYERS], target_count;
|
int target_list[MAXPLAYERS], target_count;
|
||||||
|
@ -181,12 +182,21 @@ public Action Command_PlaySound(int client, int args) {
|
||||||
target = target_list[i];
|
target = target_list[i];
|
||||||
StopSound(target, 0, lastSound[target]);
|
StopSound(target, 0, lastSound[target]);
|
||||||
}
|
}
|
||||||
PrecacheSound(arg2);
|
char precache[128];
|
||||||
|
Format(precache, sizeof(precache), "sound/%s", arg2);
|
||||||
|
bool result = PrecacheSound(arg2);
|
||||||
|
if(!result) {
|
||||||
|
ReplyToCommand(client, "Warn: Precache failed '%s'", precache);
|
||||||
|
}
|
||||||
for (int i = 0; i < target_count; i++) {
|
for (int i = 0; i < target_count; i++) {
|
||||||
target = target_list[i];
|
target = target_list[i];
|
||||||
PrintToChatAll("playgamesound %s for %N", arg2, target);
|
|
||||||
if(IsClientConnected(target) && IsClientInGame(target)) {
|
if(IsClientConnected(target) && IsClientInGame(target)) {
|
||||||
|
if(StrEqual(arg3, "direct"))
|
||||||
|
ClientCommand(target, "playgamesound %s", arg2);
|
||||||
|
else
|
||||||
|
EmitSoundToClient(target, arg2, target);
|
||||||
strcopy(lastSound[target], 64, arg2);
|
strcopy(lastSound[target], 64, arg2);
|
||||||
|
ReplyToCommand(client, "Playing '%s' to %N %s", arg2, target, arg3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,6 +394,9 @@ public void OnClientDisconnect(int client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void OnMapStart() {
|
public void OnMapStart() {
|
||||||
|
AddFileToDownloadsTable("sound/custom/mariokartmusic.mp3");
|
||||||
|
PrecacheSound("sound/custom/mariokartmusic.mp3");
|
||||||
|
|
||||||
HookEntityOutput("info_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
|
HookEntityOutput("info_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
|
||||||
HookEntityOutput("trigger_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
|
HookEntityOutput("trigger_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
|
||||||
char output[2];
|
char output[2];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue