SA-MP Forums Archive
Error pls help me - 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: Error pls help me (/showthread.php?tid=608064)



Error pls help me - kevi11 - 27.05.2016

Guys this is my script: http://pastebin.com/gGLFprw7


This is the error:
PHP код:
error 030compound statement not closed at the end of file (started at line 94
PS: If you can I can do this problem you explain how you did it so I learn a little


Re: Error pls help me - luke49 - 27.05.2016

You didn't close the bracket after SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); (2 of them), did you?


Re: Error pls help me - Slawiii - 27.05.2016

try this
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
listitem == 0)
    {
        if(
Materiali[playerid] > 399)
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a desert eagle.");
            
GivePlayerWeapon(playerid249999999);
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
            return 
1;
        }
    }
    if(
listitem == 1)
    {
          if(
Materiali[playerid] > 149)
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a pump-action shotgun.");
            
GivePlayerWeapon(playerid259999999);
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
            return 
1;
        }
    }
    if(
listitem == 2)
    {
        if(
Materiali[playerid] > 249)
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a MP5.");
            
GivePlayerWeapon(playerid299999999);
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
            return 
1;
        }
    }
    if(
listitem == 3)
    {
        if(
Materiali[playerid] > 499)
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a M4 carbine.");
            
GivePlayerWeapon(playerid319999999);
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
            return 
1;
        }
    }
    if(
listitem == 4)
    {
        if(
Materiali[playerid] > 549)
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a Spas-12.");
            
GivePlayerWeapon(playerid279999999);
            return 
1;
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
            return 
1;
        }
    }




Re: Error pls help me - kevi11 - 27.05.2016

This 2 Error
PHP код:
warning 209: function "OnDialogResponse" should return a value 
PHP код:
warning 217loose indentation 



Re: Error pls help me - Slawiii - 27.05.2016

try this

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
    if(listitem == 0) 
    { 
        if(Materiali[playerid] > 399) 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You have crafted yourself a desert eagle."); 
            GivePlayerWeapon(playerid, 24, 9999999); 
            return 1; 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); 
            return 1; 
        } 
    } 
    if(listitem == 1) 
    { 
        if(Materiali[playerid] > 149) 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You have crafted yourself a pump-action shotgun."); 
            GivePlayerWeapon(playerid, 25, 9999999); 
            return 1; 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); 
            return 1; 
        } 
    } 
    if(listitem == 2) 
    { 
        if(Materiali[playerid] > 249) 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You have crafted yourself a MP5."); 
            GivePlayerWeapon(playerid, 29, 9999999); 
            return 1; 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); 
            return 1; 
        } 
    } 
    if(listitem == 3) 
    { 
        if(Materiali[playerid] > 499) 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You have crafted yourself a M4 carbine."); 
            GivePlayerWeapon(playerid, 31, 9999999); 
            return 1; 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); 
            return 1; 
        } 
    } 
    if(listitem == 4) 
    { 
        if(Materiali[playerid] > 549) 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You have crafted yourself a Spas-12."); 
            GivePlayerWeapon(playerid, 27, 9999999); 
            return 1; 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOUR_WHITE, "You dont have enough materials to make that."); 
            return 1; 
        } 
    }
    return 1; 
}



Re: Error pls help me - kevi11 - 27.05.2016

Ty u so much


Re: Error pls help me - kevi11 - 27.05.2016

Guys this command don't give any Material why?
PHP код:
CMD:Compramateriali(playeridparams[])
{
    
ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Materiali","500 Materiali (500$)\n700 Materiali (900$)\n 1000 Materiali (2000$)","Compra","Esci");
    return 
1;




Re: Error pls help me - Konstantinos - 27.05.2016

You must check the dialogid before and then its listitems otherwise will surely be bugged with other scripts.


Re: Error pls help me - Amunra - 27.05.2016

Quote:
Originally Posted by kevi11
Посмотреть сообщение
Guys this command don't give any Material why?
PHP код:
CMD:Compramateriali(playeridparams[])
{
    
ShowPlayerDialog(playerid,7,DIALOG_STYLE_LIST,"Materiali","500 Materiali (500$)\n700 Materiali (900$)\n 1000 Materiali (2000$)","Compra","Esci");
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 7)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
Materiali[playerid] > 399)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a desert eagle.");
                    
GivePlayerWeapon(playerid249999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 1)
            {
                if(
Materiali[playerid] > 149)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a pump-action shotgun.");
                    
GivePlayerWeapon(playerid259999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 2)
            {
                if(
Materiali[playerid] > 249)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a MP5.");
                    
GivePlayerWeapon(playerid299999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 3)
            {
                if(
Materiali[playerid] > 499)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a M4 carbine.");
                    
GivePlayerWeapon(playerid319999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 4)
            {
                if(
Materiali[playerid] > 549)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a Spas-12.");
                    
GivePlayerWeapon(playerid279999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                }
            }
        }
    }
    return 
0// Some Script can't used Dialog if you use return 1 .. Lets Make Return 0 for the other script can use dialog

Try this ^^


Re: Error pls help me - Slawiii - 27.05.2016

Quote:
Originally Posted by Amunra
Посмотреть сообщение
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 7)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                if(
Materiali[playerid] > 399)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a desert eagle.");
                    
GivePlayerWeapon(playerid249999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 1)
            {
                if(
Materiali[playerid] > 149)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a pump-action shotgun.");
                    
GivePlayerWeapon(playerid259999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 2)
            {
                if(
Materiali[playerid] > 249)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a MP5.");
                    
GivePlayerWeapon(playerid299999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 3)
            {
                if(
Materiali[playerid] > 499)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a M4 carbine.");
                    
GivePlayerWeapon(playerid319999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                    return 
1;
                }
            }
            if(
listitem == 4)
            {
                if(
Materiali[playerid] > 549)
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You have crafted yourself a Spas-12.");
                    
GivePlayerWeapon(playerid279999999);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_WHITE"You dont have enough materials to make that.");
                }
            }
        }
    }
    return 
0// Some Script can't used Dialog if you use return 1 .. Lets Make Return 0 for the other script can use dialog

Try this ^^
DIALOG id 7 has only 3 listitem