07.03.2012, 12:43
how to use get player name in here so all players know that someone listened to radio once they clicked the radio station
pawn Код:
#include <a_samp>
#include <zcmd>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Radio ");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" gtfo");
print("----------------------------------\n");
}
#endif
/////////////////commands////////////////////////
COMMAND:radio(playerid, params[])
{
ShowPlayerDialog(playerid,9780,DIALOG_STYLE_LIST,"Truckers Life Radio","1. Capital Fm Manchester\r\n2. Key 103\r\n3. Radio 1","Play", "Cancel");
return 1;
}
COMMAND:stopradio(playerid, params[])
{
StopAudioStreamForPlayer(playerid);//This is the function we need to stop the audio from streaming the music.
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 9780: //Remember the ID we changed in ShowPlayerDialog? (90) That's how the DialogResponse will get to know which Dialog it's going to use.
{
if(!response)// This one is used for option 2 which we changed to (Cancel).
{
SendClientMessage(playerid, 0xff000098, "You canceled the dialog.");//This one sends a message when you close the dialog using (Cancel).
return 1;
}
switch(listitem)//This one will list the items.
{
case 0://Case 0 is basically the first line we made in ShowPlayerDialog (1.)
{
PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/CapitalManchesterMP3Low");//This function will play our desired radio. So we have to put the url between its brackets.
SendClientMessage(playerid, 0xFF0000FF, "Type /stopradio to stop audio streaming."); //This line sends a message to the listener that he can stop it using /stopradio.
}
case 1://Case 1 is the second line we put in ShowPlayerDialog (\r\n2.)
{
PlayAudioStreamForPlayer(playerid, "http://stream.radioactivity.fm:8002/");//This function will play our desired radio. So we have to put the url between its brackets.
SendClientMessage(playerid, 0xFF0000FF, "Type /stopradio to stop audio streaming.");//This line sends a message to the listener that he can stop it using /stopradio.
}
case 2://Case 2 is the third line we put in ShowPlayerDialog(\r\n3.)
{
PlayAudioStreamForPlayer(playerid, "http://bbc.co.uk/radio/listen/live/r1.asx");//This function will play our desired radio. So we have to put the url between its brackets.
SendClientMessage(playerid, 0xFF0000FF, "Type /stopradio to stop audio streaming.");//This line sends a message to the listener that he can stop it using /stopradio.
}
//You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /myradio command \r\n4. 4th \r\n5. 5th channel etc..
}
}
}
return 1;
}