SA-MP Forums Archive
Audio stream for all players on command - 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: Audio stream for all players on command (/showthread.php?tid=460376)



Audio stream for all players on command - jovapeba - 28.08.2013

Hi i need script to open dialog where i choose what song i want to play for all players. Thanks in advance.


Re: Audio stream for all players on command - LocMax - 28.08.2013

what about simple command where you just put link? You will need ZCMD, sscanf and foreach

pawn Код:
CMD:stream(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new url[200];
        if(sscanf(params,"s[200]", url)) return SendClientMessage(playerid, 0x9C9C9CAA,"Syntax: /stream [url]");
        foreach(Player, i)
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}



Re: Audio stream for all players on command - jovapeba - 28.08.2013

Quote:
Originally Posted by LocMax
Посмотреть сообщение
what about simple command where you just put link? You will need ZCMD, sscanf and foreach

pawn Код:
CMD:stream(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new url[200];
        if(sscanf(params,"s[200]", url)) return SendClientMessage(playerid, 0x9C9C9CAA,"Syntax: /stream [url]");
        foreach(Player, i)
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}
Ok, can u give me download link of sscanf zcmd and foreach and step by step instruciton where and how to put it, and will this be on /stream and big thank u


Re: Audio stream for all players on command - Konstantinos - 28.08.2013

****** them!

"samp sscanf"
"samp zcmd"
"samp foreach"

Download them, add the sscanf2.inc, zcmd.inc and foreach.inc to pawno\includes directory and the sscanf.dll or sscanf.so to your plugins folder.

Note: .dll for Windows and .so for Linux.
Note2: Don't forget to load the sscanf plugin, open server.cfg and on plugins line:
pawn Код:
plugins sscanf
// OR if it's LINUX, ignore the above.
plugins sscanf.so



Re: Audio stream for all players on command - jovapeba - 28.08.2013

Thank u both, im gonna try it.


Re: Audio stream for all players on command - jovapeba - 28.08.2013

I get this errors when compiling
C:\Documents and Settings\Korisnik\Desktop\EGV1.0\gamemodes\EuroGam ingV1.0.pwn(56980) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Korisnik\Desktop\EGV1.0\gamemodes\EuroGam ingV1.0.pwn(56980) : error 017: undefined symbol "cmd_stream"
C:\Documents and Settings\Korisnik\Desktop\EGV1.0\gamemodes\EuroGam ingV1.0.pwn(56980) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Korisnik\Desktop\EGV1.0\gamemodes\EuroGam ingV1.0.pwn(56980) : fatal error 107: too many error messages on one line


Re: Audio stream for all players on command - Konstantinos - 28.08.2013

Include them.
pawn Код:
// At the top
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <zcmd>
And the syntax LocMax used is the old one. The new syntax is:
pawn Код:
foreach(new i : Player)



Re: Audio stream for all players on command - jovapeba - 28.08.2013

Its already included, now I changed foreach with ur foreach(new i : Player)


Re: Audio stream for all players on command - jovapeba - 28.08.2013

Againg same errors. Anyone now hot to fix it?


Re: Audio stream for all players on command - Konstantinos - 28.08.2013

You should use ZCMD outside of any callback. Also it should be only one command processor, only ZCMD. Do not use OnPlayerCommandText (strcmp) + ZCMD.

An example:
pawn Код:
#include <a_samp>
#include <foreach>
#include <sscanf2>
#include <zcmd>

main() {}

public OnGameModeInit()
{
    return 1;
}

// some other callbacks

CMD:stream(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new url[200];
        if(sscanf(params,"s[200]", url)) return SendClientMessage(playerid, 0x9C9C9CAA,"Syntax: /stream [url]");
        foreach(new i: Player)
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}

// maybe some functions
It compiles fine.