Radio Scripting 0.3d
#1

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\nda");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamd by your name here");
	print("----------------------------------\n");
}

#endif


public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/myradio", cmdtext, true, 10) == 0)
	{
	 ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"My Radio list","1. My first channel\r\n2. My second channel\r\n3. My third channel","Select", "Cancel");
		// Do something here
		return 0;
	}
 if (strcmp("/stopradio", cmdtext, true, 10) == 0)
}


 StopAudioStreamForPlayer(playerid); // Stop the audio stream
	}
	return 1;
}
    
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 90: //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, 0x42F3F198, "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://radio02-cn3.akadostream.ru:8814/nrj192.mp3");//This function will play our desired radio. So we have to put the url between its brackets.
                    SendClientMessage(playerid, 0x42F3F198, "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, 0x42F3F198, "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://sc.3wk.com:8300/");//This function will play our desired radio. So we have to put the url between its brackets.
                    SendClientMessage(playerid, 0x42F3F198, "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;
}
ii do that buy i have some errors i dont now what to.. the are the errors C:\server samp\0.3df\gamemodes\Untitled.pwn(40) : warning 217: loose indentation
C:\server samp\0.3df\gamemodes\Untitled.pwn(42) : warning 217: loose indentation
C:\server samp\0.3df\gamemodes\Untitled.pwn(43) : error 029: invalid expression, assumed zero
C:\server samp\0.3df\gamemodes\Untitled.pwn(43 -- 46) : warning 215: expression has no effect
C:\server samp\0.3df\gamemodes\Untitled.pwn(46) : error 001: expected token: ";", but found "-identifier-"
C:\server samp\0.3df\gamemodes\Untitled.pwn(47) : warning 209: function "OnPlayerCommandText" should return a value
C:\server samp\0.3df\gamemodes\Untitled.pwn(4 : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.


Plese help me ...i work so much...and no result (
Reply
#2

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\nda");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamd by your name here");
    print("----------------------------------\n");
}

#endif


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/myradio", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"My Radio list","1. My first channel\r\n2. My second channel\r\n3. My third channel","Select", "Cancel");
        return 1;
    }
    if (strcmp("/stopradio", cmdtext, true, 10) == 0)
    {
        StopAudioStreamForPlayer(playerid); // Stop the audio stream
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 90: //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, 0x42F3F198, "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://radio02-cn3.akadostream.ru:8814/nrj192.mp3");//This function will play our desired radio. So we have to put the url between its brackets.
                    SendClientMessage(playerid, 0x42F3F198, "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, 0x42F3F198, "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://sc.3wk.com:8300/");//This function will play our desired radio. So we have to put the url between its brackets.
                    SendClientMessage(playerid, 0x42F3F198, "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;
}
Reply
#3

What should I do now copy the game to run it how? (If so where in GM?) Or where you copied?

P.s: works i compiled
Reply
#4

lol? I copied it from your code? Then fixed your problem then pasted it for you, basically you had a few returns in the wrong place and { facing the wrong way
Reply
#5

excuse me I was not sure as a snowman to go ... but we managed to 2 minutes after you gave me the code, thank you very much ... that and personal car for three days .. I bother the car if I could you provide a tutorial code would be very grateful ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)