Audio stream for all players on command
#1

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

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;
}
Reply
#3

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
Reply
#4

****** 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
Reply
#5

Thank u both, im gonna try it.
Reply
#6

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
Reply
#7

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)
Reply
#8

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

Againg same errors. Anyone now hot to fix it?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)