YCMD to ZCMD? +REP
#1

I don't know if that's possible but can someone please convert this:

Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i ))
        {
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
        }
    }
    return 1;
   
}
stock StopAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i ))
        {
             StopAudioStreamForPlayer(playerid);
        }
    }
    return 1;
   
}
YCMD:stopmusic(playerid, params[], help)
{
#pragma unused params
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Stops audio for everyone.");
    }
    else
    {
        new
            str[32];
        if (isnull(params))
        {
            format(str, sizeof (str), "Usage: \"/stopmusic\"";
            SendClientMessage(playerid, 0xFF0000AA, str);
        }
        else
        {
            StopAudioStreamForPlayer(playerid);
        }
    }
    return 1;
}
YCMD:music(playerid, params[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Plays audio for everyone.");
    }
    else
    {
        new
            str[32];
        if (isnull(params))
        {
            format(str, sizeof (str), "Usage: \"/music [url]\"";
            SendClientMessage(playerid, 0xFF0000AA, str);
        }
        else
        {
            PlayAudioStreamForAll(params);
        }
    }
    return 1;
}
+REP!
Reply
#2

i tried let me know if it works

pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i ))
        {
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
        }
    }
    return 1;
   
}
stock StopAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i ))
        {
             StopAudioStreamForPlayer(playerid);
        }
    }
    return 1;
   
}
CMD:stopmusic(playerid, params[])
{
    #pragma unused params
    StopAudioStreamForPlayer(playerid);
    return 1;
}

CMD:music(playerid, params[])
{
    new
        str[32];
    if (isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else
    {
        PlayAudioStreamForAll(params);
    }
    return 1;
}
also note these dont check if a player is admin first before letting them use the commands.
maybe you want that too?
Reply
#3

pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
    return 1;

}
stock StopAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
             StopAudioStreamForPlayer(playerid);
    return 1;

}
CMD:stopmusic(playerid, params[])
{
    #pragma unused params
    StopAudioStreamForPlayer(playerid);
    return 1;
}
YCMD:music(playerid, params[], help)
{
    new str[32];
    if(isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else PlayAudioStreamForAll(params);
    return 1;
}
Reply
#4

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
i tried let me know if it works

also note these dont check if a player is admin first before letting them use the commands.
maybe you want that too?
Do you know how I can add that? I want it to be rcon admin only. Thanks so much. Added rep for you already.
Reply
#5

just add

pawn Код:
if(!IsPlayerAdmin(playerid))return 0;
to the top of each zcmd
example

pawn Код:
CMD:music(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
Reply
#6

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
    return 1;

}
stock StopAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
             StopAudioStreamForPlayer(playerid);
    return 1;

}
CMD:stopmusic(playerid, params[])
{
    #pragma unused params
    StopAudioStreamForPlayer(playerid);
    return 1;
}
YCMD:music(playerid, params[], help)
{
    new str[32];
    if(isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else PlayAudioStreamForAll(params);
    return 1;
}
And did you make a typo? I see YCMD:music...
Reply
#7

This won't work..

Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
    return 1;

}
Put it like this

Код:
stock PlayAudioStreamForAll(url[])
{
    new Float:X,Float:Y,Float:Z;
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, X, Y, Z, distance);
    return 1;

}
Smilies


And the command

Код:
CMD:music(playerid, params[])
{
    new str[32];
    if(isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else PlayAudioStreamForAll(params);
    return 1;
}
Reply
#8

Quote:
Originally Posted by ivanVU
Посмотреть сообщение
This won't work..

Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, x, y, z, distance);
    return 1;

}
Put it like this

Код:
stock PlayAudioStreamForAll(url[])
{
    new Float:X,Float:Y,Float:Z;
    for(new i; i<GetMaxPlayers(); i++)
        if(IsPlayerConnected( i ))
            PlayAudioStreamForPlayer(i, url, X, Y, Z, distance);
    return 1;

}
Smilies


And the command

Код:
CMD:music(playerid, params[])
{
    new str[32];
    if(isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else PlayAudioStreamForAll(params);
    return 1;
}
Okay I'm so confused. Can you please give me the whole code combined with your code too? Thanks,
Reply
#9

heres the full code with edits,

pawn Код:
stock PlayAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i )) PlayAudioStreamForPlayer(i, url);    
    }
    return 1;
   
}
stock StopAudioStreamForAll(url[])
{
    for(new i; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected( i )) StopAudioStreamForPlayer(playerid);
    }
    return 1;
}
CMD:stopmusic(playerid, params[])
{
    #pragma unused params
    if(!IsPlayerAdmin(playerid))return 0;
    StopAudioStreamForPlayer(playerid);
    return 1;
}

CMD:music(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    new
        str[32];
    if (isnull(params))
    {
        format(str, sizeof (str), "Usage: \"/music [url]\"";
        SendClientMessage(playerid, 0xFF0000AA, str);
    }
    else
    {
        PlayAudioStreamForAll(params);
    }
    return 1;
}
this should be fulling working now

regards,
Reply
#10

Thank you so much Jonny! +rep again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)