SA-MP Forums Archive
Need 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: Need help. (/showthread.php?tid=578000)



Need help. - DeathFire - 15.06.2015

Hello.
I wanted help with a cmd (only for RCON admins):
/musicall [*******-url]

Sorry for asking for this but I've tried to script one but I can't.

Can anyone help me?


Re : Need help. - Dutheil - 15.06.2015

Yes, show us your code and we help you.


Re: Need help. - DeathFire - 15.06.2015

I can't make it that's why I'm asking.


Re: Need help. - Darkwood17 - 15.06.2015

Try this (not tested):

Код:
CMD:musicall(playerid,params[])
{
    new link[128];
    if(sscanf(params, "s[128]", link)) return SendClientMessage(playerid, -1, "Use: /musicall [Link]");
    for(new i; i < MAX_PLAYERS; i++)
    {
        PlayAudioStreamForPlayer(i, link);
    }
    return 1;
}



Re: Need help. - DeathFire - 15.06.2015

Thanks I'll test it.
Btw is it with ******* or I need to find a site with .mp3 urls?


Re: Need help. - Darkwood17 - 15.06.2015

Use this for admins only:
Код:
CMD:musicall(playerid,params[])
{
    new link[128];
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only RCON admins can use this command.");
    if(sscanf(params, "s[128]", link)) return SendClientMessage(playerid, -1, "Use: /musicall [Link]");
    for(new i; i < MAX_PLAYERS; i++)
    {
        PlayAudioStreamForPlayer(i, link);
    }
    return 1;
}
Quote:
Originally Posted by DeathFire
Посмотреть сообщение
Thanks I'll test it.
Btw is it with ******* or I need to find a site with .mp3 urls?
You have to use .mp3 urls.
If you want you can use the ******* Streamer by Michael@Belgium.


Re: Need help. - kalanerik99 - 15.06.2015

Only for ADMINS?

Код:
CMD:musicall(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new link[128];
if(sscanf(params, "s[128]", link)) return SendClientMessage(playerid, -1, "Use: /musicall [Link]");
for(new i; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, link);
}
}
else return 0;
return 1;
}



Re: Need help. - DeathFire - 15.06.2015

Thanks. +REP


Re: Need help. - kalanerik99 - 15.06.2015

Less code! (usefoul)
Код:
CMD:musicall(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new link[128];
if(sscanf(params, "s[128]", link)) return SendClientMessage(playerid, -1, "Use: /musicall [Link]");
for(new i; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, link);
}
return 1;
}



Re: Need help. - Darkwood17 - 15.06.2015

Quote:
Originally Posted by kalanerik99
Посмотреть сообщение
Less code! (usefoul)
Код:
CMD:musicall(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new link[128];
if(sscanf(params, "s[128]", link)) return SendClientMessage(playerid, -1, "Use: /musicall [Link]");
for(new i; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, link);
}
return 1;
}
What's the difference?
You just have changed this:
Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only RCON admins can use this command.");
to this:
Код:
if(!IsPlayerAdmin(playerid)) return 0;