SA-MP Forums Archive
new Random[][] = [help = 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: new Random[][] = [help = rep+] (/showthread.php?tid=482593)



new Random[][] = [help = rep+] - ic3cr3am - 21.12.2013

Код:
new RandomElectro128[][] =
{
	{"http://*******/1uQ2Zb", "song's name"}
}

PlayAudioStreamForPlayer(playerid, RandomElectro128[rand][0]);
SendClientMessage(playerid, -1, "You are listening to %s", RandomElectro128[rand][1]);
how do i do this? rep+ for help


Re: new Random[][] = [help = rep+] - Patrick - 21.12.2013

Here you go :P

pawn Код:
#include <a_samp>

new RandomElectro[][] =
{
    { "http://*******/1uQ2Zb", "song's name" }
};

public OnPlayerConnect(playerid)
{
    new rand = random( sizeof( RandomElectro ) ), string[ 128 ];

    PlayAudioStreamForPlayer(playerid, RandomElectro[ rand ][ 0 ]);

    format(string, sizeof( string ), "You are listening to %s", RandomElectro[ rand ][ 1 ]);
    SendClientMessage( playerid, -1, string );
    return true;
}
NOTE


Re: new Random[][] = [help = rep+] - Konstantinos - 21.12.2013

It needs to be a 3D array to display the song's name.