cigarettes system!
#1

hey guys im making my own idea named "addicting ciggy system" utineed some help :S im new in scripting :S look... i scripted it by using dialogs system(iused 2 dialogs so this one is the second dialog in the script) :
script:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/ciggies", true))
	{
	    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Buy ciggies", "Esse Black(10$)\nG1(10$)\nMacbeth(5$)\nMalboro(20$)\nWinston Light(50$)\nNicotine Stick(200000$)(it stops addicting to cigarettes)", "Buy", "Cancel");
		return 1;
	}

	return CreateBox(playerid, "Error", "The command you entered is ~r~unknown ~w~! ~n~use /cmds to view the server commands.");
}
and: (this one includes the 1st dialog too)
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(response)
		{
 			case 1:
			{
   				switch(listitem)
			    {
			        case 0:
			        {
     		    		PlayAudioStreamForPlayer(playerid,"http://listen.di.fm/public5/trance.asx",0.0, 0.0, 0.0, 50.0, 0);
	    				CreateBox(playerid, "Radio", "~r~Trance music ~w~radio activated!");
					}
					case 1:
					{
    					PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/harddance.asx", 0.0, 0.0, 0.0, 50.0, 0);
						CreateBox(playerid, "Radio", "~r~hard dance music ~w~radio activated!");
					}
					case 2:
					{
 	 					PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/dubstep.asx", 0.0, 0.0, 0.0, 50.0, 0);
						CreateBox(playerid, "Radio", "~r~Dubstep music ~w~radio activated!");
					}
					case 3:
					{
    					PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/djmixes.asx", 0.0, 0.0, 0.0, 50.0, 0);
	    				CreateBox(playerid, "Radio", "~r~DJ mixes music ~w~radio activated!");
					}
					case 4:
					{
	    				StopAudioStreamForPlayer(playerid);
		    			CreateBox(playerid, "Radio", "~r~Radio ~w~have been stopped!");
					}
				}
				case 2:
				{
				    case 1:
				    {
				        if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Esse Black cigarette!", "Okay", "Close");
				        GivePlayerMoney(playerid, -10);
				        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
					}
					case 2:
					{
					    if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy G1 cigarette!", "Okay", "Close");
					    GivePlayerMoney(playerid, -10);
					    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
					}
					case 3:
					{
						if(GetPlayerMoney(playerid) < 5) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Macbeth cigarette!", "Okay", "Close");
						GivePlayerMoney(playerid, -5);
						SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
					}
					case 4:
					{
						if(GetPlayerMoney(playerid) < 20) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Malboro cigarette!", "Okay", "Close");
						GivePlayerMoney(playerid, -20);
						SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
					}
					case 5:
					{
					    if(GetPlayerMoney(playerid) < 50) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Winstone Light cigarette!", "Okay", "Close");
						GivePlayerMoney(playerid, -50);
						SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
					}
					case 6:
					{
					    if(GetPlayerMoney(playerid) < 200000) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Nicotine Sticks!", "Okay", "Close");
					    GivePlayerMoney(playerid, -200000);
					    SetPlayerDrunkLevel(playerid, 0);
					}
			}
			}
		}
	return 1;
}
the error is:
Code:
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 014: invalid statement; not in switch
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : warning 215: expression has no effect
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 001: expected token: ";", but found ":"
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 029: invalid expression, assumed zero
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
how tofix it? please help me guys
Reply
#2

What line is it on. Not going to look through all of this.
Reply
#3

Post line 1450,not whole code.
Reply
#4

1450 line is this line:
Code:
 			case 1:
Reply
#5

case 1 of what?There are tons of case 1 in your code,post lines from 1445 to 1455.
Reply
#6

Try this:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(response)
    {
        case 1:
        {
            switch(listitem)
            {
                case 0:
                {
                    PlayAudioStreamForPlayer(playerid,"http://listen.di.fm/public5/trance.asx",0.0, 0.0, 0.0, 50.0, 0);
                    CreateBox(playerid, "Radio", "~r~Trance music ~w~radio activated!");
                }
                case 1:
                {
                    PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/harddance.asx", 0.0, 0.0, 0.0, 50.0, 0);
                    CreateBox(playerid, "Radio", "~r~hard dance music ~w~radio activated!");
                }
                case 2:
                {
                    PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/dubstep.asx", 0.0, 0.0, 0.0, 50.0, 0);
                    CreateBox(playerid, "Radio", "~r~Dubstep music ~w~radio activated!");
                }
                case 3:
                {
                    PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/djmixes.asx", 0.0, 0.0, 0.0, 50.0, 0);
                    CreateBox(playerid, "Radio", "~r~DJ mixes music ~w~radio activated!");
                }
                case 4:
                {
                    StopAudioStreamForPlayer(playerid);
                    CreateBox(playerid, "Radio", "~r~Radio ~w~have been stopped!");
                }
            }
        }
        case 2:
        {
            switch(listitem)
            {
                case 1:
                {
                    if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Esse Black cigarette!", "Okay", "Close");
                    GivePlayerMoney(playerid, -10);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                }
                case 2:
                {
                    if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy G1 cigarette!", "Okay", "Close");
                    GivePlayerMoney(playerid, -10);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                }
                case 3:
                {
                    if(GetPlayerMoney(playerid) < 5) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Macbeth cigarette!", "Okay", "Close");
                    GivePlayerMoney(playerid, -5);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                }
                case 4:
                {
                    if(GetPlayerMoney(playerid) < 20) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Malboro cigarette!", "Okay", "Close");
                    GivePlayerMoney(playerid, -20);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                }
                case 5:
                {
                    if(GetPlayerMoney(playerid) < 50) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Winstone Light cigarette!", "Okay", "Close");
                    GivePlayerMoney(playerid, -50);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                }
                case 6:
                {
                    if(GetPlayerMoney(playerid) < 200000) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Nicotine Sticks!", "Okay", "Close");
                    GivePlayerMoney(playerid, -200000);
                    SetPlayerDrunkLevel(playerid, 0);
                }
            }
        }
    }
    return 1;
}
Pretty obvious.

PS: Above post, I lol'ed when you said tons of case 1's. There are 3. If you looked at them, you could see which one was the problem.
Reply
#7

hmmm yeah but the first case 1 is for first dialog and the case 1 which is included in first case 1, is for the first item of first dialog
and the third case 1 is for the first item of second dialog... ^_^
Reply
#8

already tried
errors again :/
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 014: invalid statement; not in switch
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : warning 215: expression has no effect
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 001: expected token: ";", but found ":"
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 029: invalid expression, assumed zero
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#9

You need to put the case inside of switch(dialogid).
Reply
#10

but samp wiki said an exam like that :S
Reply
#11

please somebody help me
Reply
#12

Try this:

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        if(response)
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        PlayAudioStreamForPlayer(playerid,"http://listen.di.fm/public5/trance.asx",0.0, 0.0, 0.0, 50.0, 0);
                        CreateBox(playerid, "Radio", "~r~Trance music ~w~radio activated!");
                    }
                    case 1:
                    {
                        PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/harddance.asx", 0.0, 0.0, 0.0, 50.0, 0);
                        CreateBox(playerid, "Radio", "~r~hard dance music ~w~radio activated!");
                    }
                    case 2:
                    {
                        PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/dubstep.asx", 0.0, 0.0, 0.0, 50.0, 0);
                        CreateBox(playerid, "Radio", "~r~Dubstep music ~w~radio activated!");
                    }
                    case 3:
                    {
                        PlayAudioStreamForPlayer(playerid, "http://listen.di.fm/public5/djmixes.asx", 0.0, 0.0, 0.0, 50.0, 0);
                        CreateBox(playerid, "Radio", "~r~DJ mixes music ~w~radio activated!");
                    }
                    case 4:
                    {
                        StopAudioStreamForPlayer(playerid);
                        CreateBox(playerid, "Radio", "~r~Radio ~w~have been stopped!");
                    }
                }
            }
            case 2:
            {
                switch(listitem)
                {
                    case 1:
                    {
                        if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Esse Black cigarette!", "Okay", "Close");
                        GivePlayerMoney(playerid, -10);
                        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    }
                    case 2:
                    {
                        if(GetPlayerMoney(playerid) < 10) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy G1 cigarette!", "Okay", "Close");
                        GivePlayerMoney(playerid, -10);
                        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    }
                    case 3:
                    {
                        if(GetPlayerMoney(playerid) < 5) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Macbeth cigarette!", "Okay", "Close");
                        GivePlayerMoney(playerid, -5);
                        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    }
                    case 4:
                    {
                        if(GetPlayerMoney(playerid) < 20) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Malboro cigarette!", "Okay", "Close");
                        GivePlayerMoney(playerid, -20);
                        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    }
                    case 5:
                    {
                        if(GetPlayerMoney(playerid) < 50) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Winstone Light cigarette!", "Okay", "Close");
                        GivePlayerMoney(playerid, -50);
                        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    }
                    case 6:
                    {
                        if(GetPlayerMoney(playerid) < 200000) return ShowPlayerDialog(playerid,1, DIALOG_STYLE_MSGBOX, "Error", "You dont have enough money to buy Nicotine Sticks!", "Okay", "Close");
                        GivePlayerMoney(playerid, -200000);
                        SetPlayerDrunkLevel(playerid, 0);
                    }
                }
            }
        }
    }
    return 1;
}
If you can't add a simple switch, you shouldn't bother scripting. I understand you're probably a beginner, but this is very, and I mean, very, basic.
Reply
#13

i know my problem is the space of tags ... i just said that i followed the tutorial that wiki samp said... :/
Reply
#14

im so sry guy but i already tried it it had some errors too
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450 -- 1451) : error 028: invalid subscript (not an array or too many subscripts): "response"
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450 -- 1452) : error 001: expected token: "}", but found "case"
C:\Users\XTC\Desktop\XTC 3.e\gamemodes\XTC.pwn(1450 -- 1452) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


lines:
1450:
Code:
        if(response)
1452:
Code:
            case 1:
1451:
Code:
        {
Reply
#15

Quote:
Originally Posted by Kindred
View Post
If you can't add a simple switch, you shouldn't bother scripting.
If you can't understand that peoples brains are unique and work and learn in didn't ways, maybe you shouldn't live?

Hm..see what I am getting at?
Reply
#16

@steven : +1 for that
aaa and could somebody help me? :S (
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)