Music for everyone
#1

So i got script which make a music for me bat i want make it for everyone hear it.
script
Код:
CMD:music(playerid, params[])
{
   if(pInfo[playerid][pAdminLevel] >= 6)
   {
   if(isnull(params))
   {
   SendClientMessage(playerid, COLOR_RED, "USAGE: /music [URL]");
   }
   else
   {
   new string[128], name[24];
   GetPlayerName(playerid,name,24);
   format(string,sizeof(string),"Admin %s started a new song!",name);
   SendClientMessageToAll(-1,string);
   for(new i;i<MAX_PLAYERS;i++)
   {
   PlayAudioStreamForPlayer(i, params);
   }
   }
   }
   else
   {
   SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
   }
   return 1;
}
Reply
#2

Good Job! +1 from me !
Reply
#3

What is the problem ?And by the way you can replace forloop with foreach for efficient loping through connected players.
Reply
#4

Since you didn't state the problem i didn't know what was wrong with it but you've alot of unnecessary lines
Код:
CMD:music(playerid, params[])
{
   if(pInfo[playerid][pAdminLevel] >= 6) return 0;
   new string[128], name[24];
   if(isnull(params)) return  SendClientMessage(playerid, COLOR_RED, "USAGE: /music [URL]"); {
   format(string,sizeof(string),"Admin %s started a new song!",name);
   SendClientMessageToAll(-1,string);
   foreach(Player, i) {//Depends on your foreach version
   PlayAudioStreamForPlayer(i, params);
   } else  {
   SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
   }
   return true;
}
Reply
#5

So you want say this code is fine? Cuz if i put music no one hear, only me
Reply
#6

Is here to put the link change the url?
Reply
#7

Quote:
Originally Posted by AlonGlenn
Посмотреть сообщение
Is here to put the link change the url?
Amm what you mean?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)