Код:
#include <a_samp>
#include <zcmd>
#include <foreach>
#define D_MUSIC 1
#define D_MFORALL 2
#define D_MFORSELF 3
#define D_MPOS 4
#define D_MPOS1 5
#define D_MFORP 6
#define D_MFORP1 7
#define D_MFORALL1 8
#define D_MFORP2 9
#define SPD ShowPlayerDialog
new link[255];
new link1[255];
main() {return 1;}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[128];
if(dialogid == D_MFORP2)
{
if(response)
{
new igr = strval(inputtext);
if(igr != INVALID_PLAYER_ID)
{
StopAudioStreamForPlayer(igr);
}
}
}
if(dialogid == D_MFORALL1)
{
foreach(Player, i)
{
StopAudioStreamForPlayer(i);
}
}
if(dialogid == D_MFORP1)
{
if(response)
{
new igr = strval(inputtext);
if(igr != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "%s", link1);
PlayAudioStreamForPlayer(igr, string);
}
}
}
if(dialogid == D_MFORP)
{
if(response)
{
SPD(playerid, D_MFORP1, DIALOG_STYLE_INPUT, "For player", "Type the ID of the player.", "Select", "Cancel");
strmid(link1,inputtext, 0, strlen(inputtext), 255);
}
}
if(dialogid == D_MPOS1)
{
new radius = strlen(inputtext);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "%s", link);
PlayAudioStreamForPlayer(playerid, string, X, Y, Z, radius, 1);
}
if(dialogid == D_MPOS)
{
strmid(link,inputtext, 0, strlen(inputtext), 255);
SPD(playerid, D_MPOS1, DIALOG_STYLE_INPUT, "Position", "Enter the radius in the blank.", "Select", "Cancel");
}
if(dialogid == D_MFORSELF)
{
format(string, sizeof(string), "%s", inputtext);
PlayAudioStreamForPlayer(playerid, string);
}
if(dialogid == D_MFORALL)
{
foreach(Player, i)
{
format(string, sizeof(string), "%s", inputtext);
PlayAudioStreamForPlayer(i, string);
}
}
if(dialogid == D_MUSIC)
{
if(response)
{
if(listitem == 0)
{
SPD(playerid, D_MFORALL, DIALOG_STYLE_INPUT, "For all players", "Paste the link of the song, it must be .mp3 !", "Select", "Cancel");
}
if(listitem == 1)
{
SPD(playerid, D_MFORSELF, DIALOG_STYLE_INPUT, "For yourself", "Paste the link of the song, it must be .mp3 !", "Select", "Cancel");
}
if(listitem == 2)
{
SPD(playerid, D_MPOS, DIALOG_STYLE_INPUT, "Position (radius)", "Paste the link of the song, it must be .mp3 !", "Select", "Cancel");
}
if(listitem == 3)
{
SPD(playerid, D_MFORP, DIALOG_STYLE_INPUT, "For player", "Paste the link of the song, it must be .mp3 !", "Select", "Cancel");
}
if(listitem == 4)
{
SPD(playerid, D_MFORALL1, DIALOG_STYLE_MSGBOX, "For everyone", "Choose 'Yes' if you want to stop, or choose 'No' co cancel.", "Yes", "No");
}
if(listitem == 5)
{
SPD(playerid, D_MFORP2, DIALOG_STYLE_INPUT, "For player", "Type the ID of player you want to stop audio stream.", "Yes", "No");
}
}
}
return 0;
}
CMD:playmusic(playerid, params[])
{
SPD(playerid, D_MUSIC, DIALOG_STYLE_LIST, "Choose", "For all players\nYourself\nSome position\nFor player\nStop everyone\nStop for player", "Select", "Cancel");
return 1;
}