PDA

View Full Version : How to stop..


SnG.Scot_MisCuDI
31/12/2011, 02:05 AM
How can i stop dialogs interfearing with each other. i have 2 dialogs, one radio and another is object attacher. I tried combining the 2 dialogs in the same FS but it says "error 002: only a single statement (or expression) can follow each "case"" When i unload the radio the object attacher runs fine. But with radio on it wont. Any help!

Ballu Miaa
31/12/2011, 02:31 AM
Show us the Code!

SnG.Scot_MisCuDI
31/12/2011, 03:23 AM
// 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("\n--------------------------------------");
print(" Object attacher by Googamalugafoo (SnG.SCOT)");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/attacho", true))
{
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_LIST, "Object Attacher By: SnG.Scot_MisCuDi", "Cock \nDragon \nUFO \nGas \nFoam \nHat \nGlass head \nHotdog suit \nHouse head \nPumpkin head \nShark head \nAfro \nRemove", "Attach", "Cancel");
return 1;
}
if(!strcmp(cmdtext, "/radio", true))
{
ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"Enjoy some tunes (by sng.scot)","1.Rap\r\n2. Rap 2\r\n3. Techno (lol)\r\n3. Country\r\n4. Rock\r\n5. Talk Radio\r\n5. Blues\r\nRequest a station","Select", "Cancel");
return 1;
}
if (strcmp("/stopradio", cmdtext, true, 10) == 0)
{
StopAudioStreamForPlayer(playerid);//This is the function we need to stop the audio from streaming the music.
return 1;
}
return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1234:
{
if(!response)
{
SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");//This one sends a message when you close the dialog using (Cancel).
return 1;
}

switch(listitem)
{
case 0: // Cock
{
SetPlayerAttachedObject(playerid, 0, 16776, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 180.000000, 0.050000, 0.050000, 0.050000);
SetPlayerAttachedObject(playerid, 1, 321, 1, -0.200000, 0.349999, -0.150000, 90.000000, 180.000000, 0.000000, 3.000000, 3.000000, 3.000000);
}
case 1: // dragon
{
SetPlayerAttachedObject(playerid, 3, 3528, 1, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.0000, 1.00000, 1.0000);
}
case 2: // ufo
{
SetPlayerAttachedObject(playerid, 3, 16778, 1, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.0000, 1.00000, 1.0000);
}
case 3: // gas
{
SetPlayerAttachedObject(playerid, 3, 1686, 1, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.0000, 1.00000, 1.0000);
}
case 4: // foam
{
SetPlayerAttachedObject(playerid, 4, 18858, 2, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000);
}
case 5: // hat
{
SetPlayerAttachedObject(playerid, 0, 18638, 2, 0.200000, 0.009999, 0.000000, 0.000000, 0.000000, -15.000000, 1.000000, 1.000000, 1.000000);
}
case 6: // glass head
{
SetPlayerAttachedObject(playerid, 0, 18843, 2, 0.079999, 0.000000, 0.000000, 0.000000, 90.000000, 0.000000, 0.003000, 0.003000, 0.003000);
}
case 7: // hotdog suit
{
SetPlayerAttachedObject(playerid, 0, 19346, 1, 0.100000, 0.200000, 0.000000, -90.000000, 0.000000, 90.000000, 10.000000, 10.000000, 10.000000);
}
case 8: // house head
{
SetPlayerAttachedObject(playerid, 0, 3284, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 0.000000, 0.100000, 0.100000, 0.100000);
}
case 9: // pumpkin head
{
SetPlayerAttachedObject(playerid, 0, 19320, 2, 0.200000, 0.000000, 0.000000, 0.000000, 90.000000, 0.000000, 1.000000, 1.000000, 1.000000);
}
case 10: // sharkhead
{
SetPlayerAttachedObject(playerid, 0, 1608, 2, 0.000000, 0.000000, 0.000000, 0.000000, 90.000000, 0.000000, 0.300000, 0.300000, 0.300000);
}
case 11: // afro
{
SetPlayerAttachedObject(playerid, 1, 18640, 2, 0.100000, 0.000000, 0.000000, 0.000000, 0.000000, -30.000000, 1.000000, 1.000000, 1.000000);
}
case 12: // remove
{
RemovePlayerAttachedObject(playerid, 0);
RemovePlayerAttachedObject(playerid, 1);
RemovePlayerAttachedObject(playerid, 2);
RemovePlayerAttachedObject(playerid, 3);
RemovePlayerAttachedObject(playerid, 4);
}
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://yp.shoutcast.com/sbin/tunein-station.pls?id=1504548");//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://yp.shoutcast.com/sbin/tunein-station.pls?id=4490");//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://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");//This function will play our desired radio. So we have to put the url between its brackets.
}
case 3://Case 2 is the third line we put in ShowPlayerDialog(\r\n3.)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");//This function will play our desired radio. So we have to put the url between its brackets.
}
case 4://Case 2 is the third line we put in ShowPlayerDialog(\r\n3.)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");//This function will play our desired radio. So we have to put the url between its brackets.
}
case 5://Case 2 is the third line we put in ShowPlayerDialog(\r\n3.)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1026951");//This function will play our desired radio. So we have to put the url between its brackets.
}
case 6://Case 2 is the third line we put in ShowPlayerDialog(\r\n3.)
{
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1270282");//This function will play our desired radio. So we have to put the url between its brackets.
}
//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;
}
#endif
i get this error: (153) : error 002: only a single statement (or expression) can follow each "case"
And line 153 is after the #endif

Ballu Miaa
31/12/2011, 05:15 AM
Edit the Cases! you cannot have case 0 twice or any case twice in a switch function. Ill suggest you too Add the shorter FS in your GM and make other as an FS!
Will help ya i guess

SnG.Scot_MisCuDI
31/12/2011, 05:33 AM
is there a way i can have them both in the same fs like that though