SA-MP Forums Archive
MP3 Stream for all? (+REP) - 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: MP3 Stream for all? (+REP) (/showthread.php?tid=471006)



MP3 Stream for all? (+REP) - Alex_Obando - 20.10.2013

Hey, title says it all

/globalMP3 (For Admins) [Link]


Respuesta: MP3 Stream for all? (+REP) - Alex_Obando - 20.10.2013

Help with this too:

https://sampforum.blast.hk/showthread.php?tid=243421


Re: MP3 Stream for all? (+REP) - nGen.SoNNy - 20.10.2013

I hope this script i've done for you will be useful

ZCMD Link: https://sampforum.blast.hk/showthread.php?tid=91354
SSCANF Link: https://sampforum.blast.hk/showthread.php?tid=120356

pawn Код:
CMD:globalMP3( playerid, params[ ] )
{
    // ( Check Link )
    new lsMP3Link[ 56 ];
    if ( sscanf( params, "s[256]", lsMP3Link ) )
        return SendClientMessage( playerid, ~1, "USAGE: {33CCFF}/globalMP3 [MP3-Link]" );
       
    // ( Check Player Admin )
    if( !IsPlayerAdmin( playerid ) )
        return SendClientMessage( playerid, ~1, "{ff0000}ERROR: {ffffff}You have to be be logged in as RCON administrator." );
       
    // ( Play the MP3 Link for all players )
    for( new i = 0; i < MAX_PLAYERS; i++ )
        PlayAudioStreamForPlayer( playerid, lsMP3Link );
   
    // ( Return )
    return ( 1 );
}



Respuesta: MP3 Stream for all? (+REP) - Alex_Obando - 20.10.2013

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
Great, thanks Gen
Can you help me with the other link please ?


Re: MP3 Stream for all? (+REP) - nGen.SoNNy - 20.10.2013

I can but i don't understand what do you want. I can't make that check when the player connects because you have to login in as admin first.

Don't forget about the +REP :P


Respuesta: MP3 Stream for all? (+REP) - Alex_Obando - 20.10.2013

What i mean, is that if you are in a list with [COD] Tag you'll be able to join, but if you join with [COD] tag and you're not on a list you'll get kicked!


Re: MP3 Stream for all? (+REP) - rickisme - 20.10.2013

like this ?
pawn Код:
CMD:globalMP3( playerid, params[ ] )
{
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    // Check tag name
    if(strfind(name, "[COD]", true) != -1)
    {
        // ( Check Link )
        new lsMP3Link[ 56 ];
        if ( sscanf( params, "s[256]", lsMP3Link ) )
            return SendClientMessage( playerid, ~1, "USAGE: {33CCFF}/globalMP3 [MP3-Link]" );
           
        // ( Check Player Admin )
        if( !IsPlayerAdmin( playerid ) )
            return SendClientMessage( playerid, ~1, "{ff0000}ERROR: {ffffff}You have to be be logged in as RCON administrator." );
           
        // ( Play the MP3 Link for all players )
        for( new i = 0; i < MAX_PLAYERS; i++ )
            PlayAudioStreamForPlayer( playerid, lsMP3Link );
           
    }
    else
    {
        Kick(playerid);
    }
    // ( Return )
    return ( 1 );
}



Re: MP3 Stream for all? (+REP) - nGen.SoNNy - 20.10.2013

Quote:
Originally Posted by rickisme
Посмотреть сообщение
like this ?
pawn Код:
CMD:globalMP3( playerid, params[ ] )
{
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    // Check tag name
    if(strfind(name, "[COD]", true) != -1)
    {
        // ( Check Link )
        new lsMP3Link[ 56 ];
        if ( sscanf( params, "s[256]", lsMP3Link ) )
            return SendClientMessage( playerid, ~1, "USAGE: {33CCFF}/globalMP3 [MP3-Link]" );
           
        // ( Check Player Admin )
        if( !IsPlayerAdmin( playerid ) )
            return SendClientMessage( playerid, ~1, "{ff0000}ERROR: {ffffff}You have to be be logged in as RCON administrator." );
           
        // ( Play the MP3 Link for all players )
        for( new i = 0; i < MAX_PLAYERS; i++ )
            PlayAudioStreamForPlayer( playerid, lsMP3Link );
           
    }
    else
    {
        Kick(playerid);
    }
    // ( Return )
    return ( 1 );
}
Dude... it's not about that command. And where is that list? )


Re: MP3 Stream for all? (+REP) - rickisme - 20.10.2013

Quote:
Originally Posted by nGen.SoNNy
Посмотреть сообщение
Dude... it's not about that command. And where is that list? )
OMG, why so serious =.=!
just create a file name : admin.ini in scriptfiles folder
put all admin name into admin.ini ( 1 line / 1 admin name )

pawn Код:
stock CheckAdmin(username[])
{
    new string[MAX_PLAYER_NAME+1];
    if(fexist("admin.ini"))
    {
        new File: file = fopen("admin.ini", io_read);
        while(fread(file, string))
        {
            if (strcmp(username, string, true, strlen(username)) == 0)
            {
                fclose(file);
                return 1;
            }
        }
        fclose(file);
    }
    return 0;
}

CMD:globalMP3( playerid, params[ ] )
{
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    // Check tag name
    if(strfind(name, "[COD]", true) != -1)
    {
        if(CheckAdmin(name))
        {
            // ( Check Link )
            new lsMP3Link[ 56 ];
            if ( sscanf( params, "s[256]", lsMP3Link ) )
                return SendClientMessage( playerid, ~1, "USAGE: {33CCFF}/globalMP3 [MP3-Link]" );
               
            // ( Check Player Admin )
            if( !IsPlayerAdmin( playerid ) )
                return SendClientMessage( playerid, ~1, "{ff0000}ERROR: {ffffff}You have to be be logged in as RCON administrator." );
               
            // ( Play the MP3 Link for all players )
            for( new i = 0; i < MAX_PLAYERS; i++ )
                PlayAudioStreamForPlayer( playerid, lsMP3Link );
        }
        else
        {
            Kick(playerid);
        }
    }
    // ( Return )
    return ( 1 );
}
I'm noob, ok


Respuesta: Re: MP3 Stream for all? (+REP) - Alex_Obando - 20.10.2013

Quote:
Originally Posted by rickisme
Посмотреть сообщение
OMG, why so serious =.=!
just create a file name : admin.ini in scriptfiles folder
put all admin name into admin.ini ( 1 line / 1 admin name )

pawn Код:
stock CheckAdmin(username[])
{
    new string[MAX_PLAYER_NAME+1];
    if(fexist("admin.ini"))
    {
        new File: file = fopen("admin.ini", io_read);
        while(fread(file, string))
        {
            if (strcmp(username, string, true, strlen(username)) == 0)
            {
                fclose(file);
                return 1;
            }
        }
        fclose(file);
    }
    return 0;
}

CMD:globalMP3( playerid, params[ ] )
{
    new name[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
    // Check tag name
    if(strfind(name, "[COD]", true) != -1)
    {
        if(CheckAdmin(name))
        {
            // ( Check Link )
            new lsMP3Link[ 56 ];
            if ( sscanf( params, "s[256]", lsMP3Link ) )
                return SendClientMessage( playerid, ~1, "USAGE: {33CCFF}/globalMP3 [MP3-Link]" );
               
            // ( Check Player Admin )
            if( !IsPlayerAdmin( playerid ) )
                return SendClientMessage( playerid, ~1, "{ff0000}ERROR: {ffffff}You have to be be logged in as RCON administrator." );
               
            // ( Play the MP3 Link for all players )
            for( new i = 0; i < MAX_PLAYERS; i++ )
                PlayAudioStreamForPlayer( playerid, lsMP3Link );
        }
        else
        {
            Kick(playerid);
        }
    }
    // ( Return )
    return ( 1 );
}
I'm noob, ok
Hmm, can you explain the Tag stock?