SA-MP Forums Archive
What am i doing wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What am i doing wrong? (/showthread.php?tid=376555)



What am i doing wrong? - CrazyManiac - 10.09.2012

Код:
{
	if(strcmp("/gamble",cmdtext,true,10) == 0)
	{
    	switch(random(3))
    	{
			case DIALOG_GAMBLE1: ShowPlayerDialog(playerid,DIALOG_GAMBLE1,DIALOG_STYLE_MSGBOX,"{0004FF}Fruit {FF00FF}Slot {91FF00}Machine","{B34242}Berries","Pull","");
			case DIALOG_GAMBLE2: ShowPlayerDialog(playerid,DIALOG_GAMBLE2,DIALOG_STYLE_MSGBOX,"{0004FF}Fruit {FF00FF}Slot {91FF00}Machine","{B34242}Bananas","Pull","");
			case DIALOG_GAMBLE3: ShowPlayerDialog(playerid,DIALOG_GAMBLE3,DIALOG_STYLE_MSGBOX,"{0004FF}Fruit {FF00FF}Slot {91FF00}Machine","{B34242}Apples","Pull","");
		}

	return 1;
}
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GAMBLE1)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE5, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE5, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE2)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE4, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Bananas {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE4, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {D0DB00}Apples", "Pull", "");
        }
    }
	if(dialogid == DIALOG_GAMBLE3)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	ShowPlayerDialog(playerid, DIALOG_GAMBLE6, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE6, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples", "Pull", "");
        }
    }
	if(dialogid == DIALOG_MAKEADMIN)
    {
        if(response) // MakeMeAdmin (if they clicked 'Send', or pressed Enter)
        {
			SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: Wrong Code!");
        }
        else // MakeMeAdmin (if they pressed ESC, or clicked 'Cancel')
        {
			SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: You have canceled the MakeMeAdmin.");
        }
    }
    if(dialogid == DIALOG_GAMBLE4)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	ShowPlayerDialog(playerid, DIALOG_GAMBLE8, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE8, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE5)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	ShowPlayerDialog(playerid, DIALOG_GAMBLE9, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Berries {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE9, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Berries {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE6)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	ShowPlayerDialog(playerid, DIALOG_GAMBLE7, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples {91FF00}Apples", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
			ShowPlayerDialog(playerid, DIALOG_GAMBLE7, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples {91FF00}Apples", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE7)
   	{
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	SendClientMessage(playerid,0xFF0000FF,"You won!");
        }
        else // Slot Machine (if they pressed ESC)
        {
			SendClientMessage(playerid,0xFF0000FF,"You won!");
        }
    }
    if(dialogid == DIALOG_GAMBLE8)
	{
		if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	SendClientMessage(playerid,0xFF0000FF,"You lost!");
        }
        else // Slot Machine (if they pressed ESC)
        {
			SendClientMessage(playerid,0xFF0000FF,"You lost!");
		)
    }
    if(dialogid == DIALOG_GAMBLE9)
   	{
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
   	    	SendClientMessage(playerid,0xFF0000FF,"You lost!");
        }
        else // Slot Machine (if they pressed ESC)
        {
			SendClientMessage(playerid,0xFF0000FF,"You lost!");
		)
    }
	return 0;
}
Warnings:

Код:
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(134) : warning 217: loose indentation
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(396) : warning 217: loose indentation
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(396) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(398) : warning 217: loose indentation
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(407) : warning 217: loose indentation
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(407) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(409) : warning 217: loose indentation
C:\Documents and Settings\Fabian\My Documents\SAMP Scripting Tools\gamemodes\slotmachine8.pwn(411) : error 030: compound statement not closed at the end of file (started at line 389)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Please fix it for me.
Greetz, CrazyManiac.


Re: What am i doing wrong? - Kirollos - 10.09.2012

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_GAMBLE1)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE5, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE5, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE2)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE4, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Bananas {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE4, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {D0DB00}Apples", "Pull", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE3)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE6, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples", "Pull", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE6, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples", "Pull", "");
        }
    }
    if(dialogid == DIALOG_MAKEADMIN)
    {
        if(response) // MakeMeAdmin (if they clicked 'Send', or pressed Enter)
        {
            SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: Wrong Code!");
        }
        else // MakeMeAdmin (if they pressed ESC, or clicked 'Cancel')
        {
            SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: You have canceled the MakeMeAdmin.");
        }
    }
    if(dialogid == DIALOG_GAMBLE4)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE8, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE8, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Bananas {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE5)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE9, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Berries {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE9, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Berries {91FF00}Apples {91FF00}Bananas", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE6)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE7, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples {91FF00}Apples", "Exit", "");
        }
        else // Slot Machine (if they pressed ESC)
        {
            ShowPlayerDialog(playerid, DIALOG_GAMBLE7, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{91FF00}Apples {91FF00}Apples {91FF00}Apples", "Exit", "");
        }
    }
    if(dialogid == DIALOG_GAMBLE7)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            SendClientMessage(playerid,0xFF0000FF,"You won!");
        }
        else // Slot Machine (if they pressed ESC)
        {
            SendClientMessage(playerid,0xFF0000FF,"You won!");
        }
    }
    if(dialogid == DIALOG_GAMBLE8)
    {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            SendClientMessage(playerid,0xFF0000FF,"You lost!");
        }
        else // Slot Machine (if they pressed ESC)
        {
            SendClientMessage(playerid,0xFF0000FF,"You lost!");
    }
    }
    if(dialogid == DIALOG_GAMBLE9)
   {
        if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
        {
            SendClientMessage(playerid,0xFF0000FF,"You lost!");
        }
        else // Slot Machine (if they pressed ESC)
        {
            SendClientMessage(playerid,0xFF0000FF,"You lost!");
    }
   }
    return 0;
}



Re: What am i doing wrong? - CrazyManiac - 11.09.2012

Thank you very much. It worked!