Not returning command in dialogresponse
#1

Код:
#if defined CREDITS
							___________________________________
							|                                  |
							| Radio System                     |
							| - made by [RNG]DuReX             |
							| - timp de lucru: 30 de minute    |
							| - versiune: 1.0                  |
							| - data: 13 februarie 2012        |
							| - linii: 181                     |
							| Alte credite:                    |
							| - Zeex (ZCMD Command Processor)  |
							| - creatorii radio-urilor         |
							|__________________________________|


#endif
//=====================================//
#include 					<a_samp>
#include 					<zcmd>
//=====================================//
#define		DIALOG_RADIO 	2012
#define COLOR_LIGHTBLUE 0x33CCFFAA
//=====================================//
new string[256], pName[MAX_PLAYER_NAME];

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("DuReX's Radio Filterscript v1.0 loaded!");
	print("--------------------------------------\n");
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_RADIO)
    {
        if(response)
        {
            switch(listitem)
			{
 				case 0: return cmd_radiowish(playerid);
				case 1:return cmd_hot108(playerid);
				case 2: return cmd_contactfm(playerid);
				case 3: return cmd_romanianhiphop(playerid);
				case 4: return cmd_romanianmanele(playerid);
				case 5: return cmd_romanianpopular(playerid);
				case 6: return cmd_profm(playerid);
				case 7: return cmd_gmusic(playerid);
				case 8: return cmd_radiotube(playerid);
				case 9: return cmd_radiomafia(playerid);
				case 10: return cmd_greudedifuzat(playerid);
				case 11: return cmd_stopradio(playerid);
        	}
   		}
        return 1;
    }
    return 1;
}
CMD:radio(playerid, params[])
{
    new sradio[1900];
    strcat(sradio, "{FFFFFF}RadioWISH {FF0000}\t\t\t /radiowish\n", 1900 );
    strcat(sradio, "{FFFFFF}Hot 108 JAMZ {FF0000}\t\t\t /hot108\n", 1900 );
    strcat(sradio, "{FFFFFF}Contact FM {FF0000}\t\t\t /contactfm\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Hip-Hop {FF0000}\t /romanianhiphop\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Manele {FF0000}\t /romanianmanele\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Popular {FF0000}\t /romanianpopular\n", 1900 );
    strcat(sradio, "{FFFFFF}Pro FM {FF0000}\t\t\t\t /profm\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio GMusic Rock {FF0000}\t\t /gmusic\n", 1900 );
    strcat(sradio, "{FFFFFF}radio-tube.pl Dubstep {FF0000}\t\t /radiotube\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Mafia {FF0000}\t\t\t /radiomafia\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Greu de Difuzat {FF0000}\t\t /greudedifuzat\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Off         {FF0000} \t\t               /stopradio", 1900 );
 	ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_LIST, "{FFFFFF}LV-GW {FF0000}Radio Stations", sradio, "Select","Cancel");
	return 1;
}
CMD:hot108(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Hot 108 JAMZ (/hot108)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=32999");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio hit~w~...", 1500, 3);
	return 1;
}
CMD:radiowish(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}RadioWISH (/radiowish)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://www.radiowish.ro/live.m3u");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio wish~w~...", 1500, 3);
	return 1;
	}
CMD:contactfm(playerid)
{
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Contact FM (/contactfm)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://www.contactfm.ro/listen.pls");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~contact fm~w~...", 1500, 3);
	return 1;
}
CMD:romanianhiphop(playerid)
{
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Hip-Hop (/romanianhiphop)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/hiphop.pls");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian hip-hop~w~...", 1500, 3);
	return 1;
}
CMD:romanianpopular(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Popular (/romanianpopular)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/popular.pls");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian popular~w~...", 1500, 3);
	return 1;
}
CMD:romanianmanele(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Manele (/romanianmanele)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/manele.pls");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian manele~w~...", 1500, 3);
	return 1;
}
CMD:profm(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Pro FM (/profm)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~pro fm~w~...", 1500, 3);
	return 1;
}
CMD:gmusic(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio GMusic Rock (/gmusic)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://www.radiogmusic.com/rock.m3u");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio gmusci rock~w~...", 1500, 3);
	return 1;
}
CMD:radiotube(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}radio-tube.pl Dubstep (/radiotube)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://s4.radiohost.pl:8154/listen.pls");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio-tube.pl dubstep~w~...", 1500, 3);
	return 1;
}
CMD:radiomafia(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Mafia (/radiomafia)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://www.radiomafia.ro/listen.m3u");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio mafia~w~...", 1500, 3);
	return 1;
}
CMD:greudedifuzat(playerid)
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Greu de Difuzat (/greudedifuzat)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
	PlayAudioStreamForPlayer(playerid, "http://www.greudedifuzat.eu/greudedifuzat.m3u");
	GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio greu de difuzat~w~...", 1500, 3);
	return 1;
}
CMD:stopradio(playerid)
{
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Radio successfully turned off.");
	StopAudioStreamForPlayer(playerid);
	return 1;
}
//End of the script. © 2012 [RNG]DuReX.=======================================//
Reply
#2

EDIT: http://pastebin.com/aUTbkStN

Seems return 1; has to be the first return, return 0; has to be the last return in OnDialogResponse. Please check if it works.
Reply
#3

Not working ;/
Reply
#4

You have not done the return cmd_this properly. Here's the example.

pawn Код:
CMD:this(playerid, params[])
{
      return 1;
}

CMD:that(playerid, params[]) return cmd_this(playerid, params);
That [] is not necessary for returns.

Anyhow, here's the new code I edited. I indented it, also.

http://pastebin.com/EnT3beAt
Reply
#5

try

pawn Код:
/*              ___________________________________
                            |                                  |
                            | Radio System                     |
                            | - made by [RNG]DuReX             |
                            | - timp de lucru: 30 de minute    |
                            | - versiune: 1.0                  |
                            | - data: 13 februarie 2012        |
                            | - linii: 181                     |
                            | Alte credite:                    |
                            | - Zeex (ZCMD Command Processor)  |
                            | - creatorii radio-urilor         |
                            |__________________________________|*/



//=====================================//
#include                    <a_samp>
#include                    <zcmd>
//=====================================//
#define     DIALOG_RADIO    2012
#define COLOR_LIGHTBLUE 0x33CCFFAA
//=====================================//
new string[256], pName[MAX_PLAYER_NAME];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("DuReX's Radio Filterscript v1.0 loaded!");
    print("--------------------------------------\n");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
        switch(dialogid)
        {
            case DIALOG_RADIO:
            {  
                switch(listitem)
                {
                    case 0: return cmd_radiowish(playerid, params);
                    case 1: return cmd_hot108(playerid, params);
                    case 2: return cmd_contactfm(playerid, params);
                    case 3: return cmd_romanianhiphop(playerid, params);
                    case 4: return cmd_romanianmanele(playerid, params);
                    case 5: return cmd_romanianpopular(playerid, params);
                    case 6: return cmd_profm(playerid, params);
                    case 7: return cmd_gmusic(playerid, params);
                    case 8: return cmd_radiotube(playerid, params);
                    case 9: return cmd_radiomafia(playerid, params);
                    case 10: return cmd_greudedifuzat(playerid, params);
                    case 11: return cmd_stopradio(playerid, params);
                }
                return 1;
            }
        }
    }
    return 0;
}
CMD:radio(playerid, params[])
{
    new sradio[1900];
    strcat(sradio, "{FFFFFF}RadioWISH {FF0000}\t\t\t /radiowish\n", 1900 );
    strcat(sradio, "{FFFFFF}Hot 108 JAMZ {FF0000}\t\t\t /hot108\n", 1900 );
    strcat(sradio, "{FFFFFF}Contact FM {FF0000}\t\t\t /contactfm\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Hip-Hop {FF0000}\t /romanianhiphop\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Manele {FF0000}\t /romanianmanele\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Romanian Popular {FF0000}\t /romanianpopular\n", 1900 );
    strcat(sradio, "{FFFFFF}Pro FM {FF0000}\t\t\t\t /profm\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio GMusic Rock {FF0000}\t\t /gmusic\n", 1900 );
    strcat(sradio, "{FFFFFF}radio-tube.pl Dubstep {FF0000}\t\t /radiotube\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Mafia {FF0000}\t\t\t /radiomafia\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Greu de Difuzat {FF0000}\t\t /greudedifuzat\n", 1900 );
    strcat(sradio, "{FFFFFF}Radio Off         {FF0000} \t\t               /stopradio", 1900 );
    ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_LIST, "{FFFFFF}LV-GW {FF0000}Radio Stations", sradio, "Select","Cancel");
    return 1;
}
CMD:hot108(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Hot 108 JAMZ (/hot108)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=32999");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio hit~w~...", 1500, 3);
    return 1;
}
CMD:radiowish(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}RadioWISH (/radiowish)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://www.radiowish.ro/live.m3u");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio wish~w~...", 1500, 3);
    return 1;
    }
CMD:contactfm(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Contact FM (/contactfm)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://www.contactfm.ro/listen.pls");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~contact fm~w~...", 1500, 3);
    return 1;
}
CMD:romanianhiphop(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Hip-Hop (/romanianhiphop)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/hiphop.pls");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian hip-hop~w~...", 1500, 3);
    return 1;
}
CMD:romanianpopular(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Popular (/romanianpopular)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/popular.pls");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian popular~w~...", 1500, 3);
    return 1;
}
CMD:romanianmanele(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Romanian Manele (/romanianmanele)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://radioromanian.net/manele.pls");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio romanian manele~w~...", 1500, 3);
    return 1;
}
CMD:profm(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Pro FM (/profm)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~pro fm~w~...", 1500, 3);
    return 1;
}
CMD:gmusic(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio GMusic Rock (/gmusic)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://www.radiogmusic.com/rock.m3u");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio gmusci rock~w~...", 1500, 3);
    return 1;
}
CMD:radiotube(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}radio-tube.pl Dubstep (/radiotube)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://s4.radiohost.pl:8154/listen.pls");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio-tube.pl dubstep~w~...", 1500, 3);
    return 1;
}
CMD:radiomafia(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Mafia (/radiomafia)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://www.radiomafia.ro/listen.m3u");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio mafia~w~...", 1500, 3);
    return 1;
}
CMD:greudedifuzat(playerid, params[])
{
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"{FF0000}%s {FFFFFF}is now playing {FF0000}Radio Greu de Difuzat (/greudedifuzat)",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    PlayAudioStreamForPlayer(playerid, "http://www.greudedifuzat.eu/greudedifuzat.m3u");
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~w~buffering ~r~radio greu de difuzat~w~...", 1500, 3);
    return 1;
}
CMD:stopradio(playerid, params[])
{
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Radio successfully turned off.");
    StopAudioStreamForPlayer(playerid);
    return 1;
}
//End of the script. © 2012 [RNG]DuReX.=======================================//
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)