SA-MP Forums Archive
Small question - 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: Small question (/showthread.php?tid=336554)



Small question - ikbenremco - 22.04.2012

Hey I wanna define songs Like if I do /radio 1 that 1 = song called Dare mama from tupac,
how to define liek this code :

Код:
CMD:tupacmary(playerid, params[])
{
    new string[128];
    if(playerVariables[playerid][pAdminLevel] >= 3)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            PlayAudioStreamForPlayer(i, "http://www.symphonyofnoise.com/binv2/ListenRap/06.Tupac-HailMairy.mp3");
        }
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "Music Admin: %s has started the Song Tupac - Hail mary", szPlayerName);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
    }

    return 1;
}
Just that this song is #1,

So it's better to do like /playglobal songid


Re: Small question - Alternative112 - 22.04.2012

Код:
CMD:radio(playerid, params[])
{
    new string[128], url[126];
    new id = strval(params[0]);
    if(playerVariables[playerid][pAdminLevel] >= 3)
    {
        switch(id) {
			case 1: format(url, sizeof(url), "http://www.symphonyofnoise.com/binv2/ListenRap/06.Tupac-HailMairy.mp3");
			default: return 1;
        }
		
		for(new i = 0; i < MAX_PLAYERS; i++) {
			PlayAudioStreamForPlayer(i, url);
		}

        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "Music Admin: %s has started the Song Tupac - Hail mary", szPlayerName);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
    }
    return 1;
}
Try this.

You may also want to make it so that if someone just types /radio in, or an invalid radio number, it shows a list of the songs.


Re: Small question - ikbenremco - 23.04.2012

Thanks the code works but how do I do that the song name changes every other case ?


Re: Small question - ikbenremco - 24.04.2012

24 hours passed,

But it's just i want when I'll do /radio 1 that it is saying Playing song "songname"
/radio 2 "playing song songname2"