Music command help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Music command help (
/showthread.php?tid=423943)
Music command help -
MichaelWharton101 - 20.03.2013
How can I make it so I can play a song with my /music command and only type '190proof.mp3' as of now I have to type 'http://americanrp.x10.mx/songs/190proof.mp3' and is a bit annoying.
Код:
CMD:music(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /music [url]");
if(!strcmp(params, "stop", true, 4))
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_LIGHTRED, " You have stopped listening to music.");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
format(string, sizeof(string), "AdmCmd: %s has started playing a song globally. ('/music stop' to stop listening)", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params);
}
return 1;
}
Re: Music command help -
mastermax7777 - 20.03.2013
Try this...
pawn Код:
CMD:music(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /music [url]");
if(!strcmp(params, "stop", true, 4))
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_LIGHTRED, " You have stopped listening to music.");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
format(string, sizeof(string), "AdmCmd: %s has started playing a song globally. ('/music stop' to stop listening)", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string,sizeof(string),"http://americanrp.x10.mx/songs/%s",params);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, string);
}
return 1;
}