Сделал плагин для включения игрокам музыки через sm_play.
Он работает , но в консоле пишет : "Не найден подходящий игрок"Добавлено (06.09.2012, 11:42:08)
---------------------------------------------
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Scorpion Super Admin",
author = "Scorpion",
description = "SoundMenu",
version = "1.00",
url = "http://deadzone.sosbb.net/"
}
new String:name[64];
public OnPluginStart()
{
RegAdminCmd("mus", ConsoleCmd, ADMFLAG_RESERVATION);
decl String:buffer[80];
PrecacheSound("music/res.mp3", true);
Format(buffer, sizeof(buffer), "sound/%s", "music/res.mp3");
AddFileToDownloadsTable(buffer)
}
public Action:ConsoleCmd(player,args){
if(GetUserAdmin(player))
{
if(!args){
new Handle:menu = CreateMenu(MenuHandler1);
SetMenuTitle(menu, "Which player?");
new String:playerName[64];
new String:playerIndex[6];
for(new client=1;client<GetMaxClients();client++){
if(IsClientInGame(client)){
IntToString(client,playerIndex,sizeof(playerIndex));
GetClientName(client,playerName,sizeof(playerName));
AddMenuItem(menu,playerIndex,playerName);
}
}
AddMenuItem(menu,"@all","Everyone");
SetMenuExitButton(menu,true);
DisplayMenu(menu, player, MENU_TIME_FOREVER);
}
return Plugin_Handled;
}
}
public MenuHandler1(Handle:menu, MenuAction:action, client, param2)
{
if (action == MenuAction_Select)
{
new String:info[64];
new String:playerName[64];
new String:playerIndex[6];
GetMenuItem(menu, param2, info, sizeof(info));
GetClientName(client, name, sizeof(name));
new Handle:musicmenu = CreateMenu(MenuHandler1);
SetMenuTitle(musicmenu, "Music Menu");
AddMenuItem(musicmenu, "HL2_song4", "Adrenaline");
AddMenuItem(musicmenu, "HL2_song31", "Calm Battle");
AddMenuItem(musicmenu, "HL1_song17", "Calm Travel");
AddMenuItem(musicmenu, "HL2_song16", "Cautious Travel");
AddMenuItem(musicmenu, "HL2_song12_long", "Easy Battle");
AddMenuItem(musicmenu, "HL2_song7", "Entrance to Ravenholm");
AddMenuItem(musicmenu, "HL2_song6", "Final Ascend");
AddMenuItem(musicmenu, "HL1_song25_REMIX3", "Half-Life 1 Credits");
AddMenuItem(musicmenu, "HL2_song3", "Half-Life 2 Credits");
AddMenuItem(musicmenu, "HL2_song15", "Half-Life 2 Credits 2");
AddMenuItem(musicmenu, "HL2_song10", "Heavens");
AddMenuItem(musicmenu, "HL2_song17", "Horrific Discovery");
AddMenuItem(musicmenu, "HL2_song28", "Horror");
AddMenuItem(musicmenu, "HL2_song29", "Intense Escape");
AddMenuItem(musicmenu, "HL2_song14", "Journey");
AddMenuItem(musicmenu, "HL2_song25_Teleporter", "Majestical Horror");
AddMenuItem(musicmenu, "HL2_song23_SuitSong3", "Memories");
AddMenuItem(musicmenu, "HL2_song19", "Nova Prospekt");
AddMenuItem(musicmenu, "Ravenholm_1", "Ravenholm Ending");
AddMenuItem(musicmenu, "HL1_song10", "River Chase");
AddMenuItem(musicmenu, "HL2_song20_submix0", "Slow Battle");
AddMenuItem(musicmenu, "HL2_song20_submix4", "Slow Battle 2");
AddMenuItem(musicmenu, "HL2_song32", "Sad End");
AddMenuItem(musicmenu, "HL1_song11", "Source Engine");
AddMenuItem(musicmenu, "HL2_song33", "Spooky Place");
AddMenuItem(musicmenu, "HL1_song19", "Spooky Tunnel");
AddMenuItem(musicmenu, "Residend", "Resident");
SetMenuExitBackButton(musicmenu, true);
DisplayMenu(musicmenu, client, 0);
if(strcmp(info, "HL2_song4") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song4.mp3", playerName);
}
if(strcmp(info, "HL2_song31") == 0)
{
ClientCommand(client, "sm_play %d /music/HL2_song31.mp3", playerName);
}
if(strcmp(info, "HL1_song17") == 0)
{
IntToString(client,playerIndex,sizeof(playerIndex));
GetClientName(client,playerName,sizeof(playerName));
ClientCommand(client, "sm_play %d /music/HL1_song17.mp3", playerName);
}
if(strcmp(info, "HL2_song16") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song16.mp3", playerName);
}
if(strcmp(info, "HL2_song12_long") == 0)
{
ServerCommand("sm_play %N /music/HL2_song12_long.mp3", playerName);
}
if(strcmp(info, "HL2_song7") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song7.mp3", playerName);
}
if(strcmp(info, "HL2_song6") == 0)
{
ClientCommand(client, "sm_play @all /music/HL2_song6.mp3", playerName);
}
if(strcmp(info, "HL1_song25_REMIX3") == 0)
{
ClientCommand(client, "sm_play %N /music/HL1_song25_REMIX3.mp3", playerName);
}
if(strcmp(info, "HL2_song3") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song3.mp3", playerName);
}
if(strcmp(info, "HL2_song15") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song15.mp3", playerName);
}
if(strcmp(info, "HL2_song10") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song10.mp3", playerName);
}
if(strcmp(info, "HL2_song17") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song17.mp3", playerName);
}
if(strcmp(info, "HL2_song28") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song28.mp3", playerName);
}
if(strcmp(info, "HL2_song29") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song29.mp3", playerName);
}
if(strcmp(info, "HL2_song14") == 0)
{
ClientCommand(client, "sm_play %N HL2_song14.mp3", playerName);
}
if(strcmp(info, "HL2_song25_Teleporter") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song25_Teleporter.mp3", playerName);
}
if(strcmp(info, "HL2_song23_SuitSong3") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song23_SuitSong3.mp3", playerName);
}
if(strcmp(info, "HL2_song19") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song19.mp3", playerName);
}
if(strcmp(info, "Ravenholm_1") == 0)
{
ClientCommand(client, "sm_play %N /music/Ravenholm_1.mp3", playerName);
}
if(strcmp(info, "HL1_song10") == 0)
{
ClientCommand(client, "sm_play %N /music/HL1_song10.mp3", playerName);
}
if(strcmp(info, "HL2_song20_submix0") == 0)
{
ClientCommand(client, "sm_play v /music/HL2_song20_submix0.mp3", playerName);
}
if(strcmp(info, "HL2_song20_submix4") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song20_submix4.mp3", playerName);
}
if(strcmp(info, "HL2_song32") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song32.mp3", playerName);
}
if(strcmp(info, "HL1_song11") == 0)
{
ClientCommand(client, "sm_play %N /music/HL1_song11.mp3", playerName);
}
if(strcmp(info, "HL2_song33") == 0)
{
ClientCommand(client, "sm_play %N /music/HL2_song33.mp3", playerName);
}
if(strcmp(info, "HL1_song19") == 0)
{
ClientCommand(client, "sm_play %N /music/HL1_song19.mp3", playerName);
}
if(strcmp(info, "Resident") == 0)
{
ClientCommand(client, "sm_play %N /music/res.mp3", playerName);
}
return Plugin_Handled
}
}