PlayStreamForAll
#1

Can SomeHelp me with this command im going crazy to fix it and couldn't find by anywhere how to make it by strcmp:

When Im using Params Insted of str, it gives me an error in game "unknown command".
(im not using zcmd only dcmd, cause zcmd crashes all my commands)
So i tried to make it strcmp and it just shows ingame "Audio Stream: [NOTINGHERE]"
Код:
stock PlayStreamForAll(playerid)
{
	foreach(Player, i)
	{
		StopAudioStreamForPlayer(i);
		PlayAudioStreamForPlayer(i, str);
		print("[AdmCmd]: Admin Is Streaming Music Globally.");
	}
	return 1;
}
Код:
if(strcmp(cmd, "/stream", true) == 0)
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	        new str[128];
		foreach(Player, i)
		{
			PlayStreamForAll(str);
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GREY,"   You are not authorized to use that command !");
	}
}
Help me fixing this please
Reply
#2

pawn Код:
stock PlayStreamForAll(url[])
{
    foreach(Player, i)
    {
        StopAudioStreamForPlayer(i);
        PlayAudioStreamForPlayer(i, url);
    }
    print("[AdmCmd]: Admin Is Streaming Music Globally.");
    return 1;
}
pawn Код:
if(strcmp(cmd, "/stream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new url[128];
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(url) - 1)))
        {
            url[idx - offset] = cmdtext[idx];
            idx++;
        }
        url[idx - offset] = EOS;
        foreach(Player, i)
        {
            PlayStreamForAll(url);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY,"   You are not authorized to use that command !");
    }
}
Try that, but this would be better scripted using ZCMD and sscanf2.
Reply
#3

Quote:
Originally Posted by Xabi
Посмотреть сообщение
pawn Код:
stock PlayStreamForAll(url[])
{
    foreach(Player, i)
    {
        StopAudioStreamForPlayer(i);
        PlayAudioStreamForPlayer(i, url);
    }
    print("[AdmCmd]: Admin Is Streaming Music Globally.");
    return 1;
}
pawn Код:
if(strcmp(cmd, "/stream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new url[128];
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(url) - 1)))
        {
            url[idx - offset] = cmdtext[idx];
            idx++;
        }
        url[idx - offset] = EOS;
        foreach(Player, i)
        {
            PlayStreamForAll(url);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY,"   You are not authorized to use that command !");
    }
}
Try that, but this would be better scripted using ZCMD and sscanf2.
I've tried to get ingame and use just /stream then /stream [url] and look what it did:


Plus it played the music 3 times and when i used /stopstream with this command:
Код:
// Stops music for everyone!
if(strcmp(cmd, "/stopstream", true) == 0)
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    foreach(Player, i)
	    {
	        StopAudioStreamForPlayer(i);
		}
	}
	return 1;
}
it stops only 2 of those URL's, and i cant stop the third..
Reply
#4

Try to make the foreach this what

pawn Код:
foreach(new i : Player)
Reply
#5

Quote:
Originally Posted by Xabi
Посмотреть сообщение
Try to make the foreach this what

pawn Код:
foreach(new i : Player)
At the command? Or at the Stock?

I've tried to compile and it gives me the errors:

Код:
error 017: undefined symbol "foreach"
error 029: invalid expression, assumed zero
error 017: undefined symbol "i"
fatal error 107: too many error messages on one line
either if i try switch the foreach on stock or command^

Top GM:
Код:
#include <foreach>
Reply
#6

I think is this you want...

i don't test if this code :S

pawn Код:
stock PlayStreamForAll(link[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        StopAudioStreamForPlayer(i);
        PlayAudioStreamForPlayer(i, link)
    }
    print("[AdmCmd]: Admin Is Streaming Music Globally.");
    return 1;
}

if(strcmp(cmd, "/stream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new link[128];
        if(sscanf(cmdtext, "s[128]", cmd, link))
        {
            SendClientMessage(playerid, COLOR_GREY,"USAGE: /stream <link>");
            return 1;
        }
        PlayStreamForAll(link);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY,"   You are not authorized to use that command !");
    }
    return 1;
}

if(strcmp(cmd, "/stopstream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            StopAudioStreamForPlayer(i);
        }
    }
    return 1;
}
this uses SSCANF by ******
Reply
#7

Quote:
Originally Posted by PT
Посмотреть сообщение
I think is this you want...

i don't test if this code :S

pawn Код:
stock PlayStreamForAll(link[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        StopAudioStreamForPlayer(i);
        PlayAudioStreamForPlayer(i, link)
    }
    print("[AdmCmd]: Admin Is Streaming Music Globally.");
    return 1;
}

if(strcmp(cmd, "/stream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new link[128];
        if(sscanf(cmdtext, "s[128]", cmd, link))
        {
            SendClientMessage(playerid, COLOR_GREY,"USAGE: /stream <link>");
            return 1;
        }
        PlayStreamForAll(link);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY,"   You are not authorized to use that command !");
    }
    return 1;
}

if(strcmp(cmd, "/stopstream", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            StopAudioStreamForPlayer(i);
        }
    }
    return 1;
}
this uses SSCANF by ******
Well, what about stock PlayStreamForAll(link[]) ?
Do it that way:
Код:
stock PlayStreamForAll(link[])
{
    foreach(Player, i)
    //foreach(new i : Player)
    {
        StopAudioStreamForPlayer(i);
        PlayAudioStreamForPlayer(i, link);
    }
    return 1;
}
Cause this way shows me just Audio stream: <noting here>
Reply
#8

Help it does noting but Audio Stream: <noting here> :/
Reply
#9

Quote:
Originally Posted by maxpain43
Посмотреть сообщение
Help it does noting but Audio Stream: <noting here> :/
i don't undestand yet what you want
Reply
#10

Quote:
Originally Posted by PT
Посмотреть сообщение
i don't undestand yet what you want
When i Use /stream [url] for example /stream http://yp.shoutcast.com/tunein-station.pls?id=48370 it shows:
Audio Stream :
thats it^ doesn't play music or streaming link^
I want the when /stream [url] the url acually downlaod and play and It should look like this:

Please help !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)