error 029: invalid expression, assumed zero
#1

When i compile, pawno return me this error "error 029: invalid expression, assumed zero" on the line "else".. Can somebody help me?
This is code
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CARPENTIERE)
    {
        if(response)
        {
            Carpentiere[playerid] = 1;
            ShowInfoForPlayer(playerid,"Hai accettato il lavoro.", 3000);
            SetPlayerAttachedObject(playerid,4,18635,6,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
            new x = random (2);
            if(x == 0)
            {
            SetPlayerCheckpoint(playerid, 1280.0118, -1262.7102, 13.5107, 2.0);
            }
            if(x == 1)
            {
            SetPlayerCheckpoint(playerid,1280.9083, -1242.0677, 13.9160, 2.0);
            {
            if(x == 2 || x ==3)
            {
            SetPlayerCheckpoint(playerid,1268.9485, -1234.4961, 17.0519, 2.0);
            }
            CarCP[playerid] = 1;
            }
            else //this is the error line
            {
            Carpentiere[playerid] = 0;
            ShowInfoForPlayer(playerid,"Hai rifiutato il lavoro.", 3000);
            RemovePlayerAttachedObject(playerid,4);
            DisablePlayerCheckpoint(playerid);
            CarCP[playerid] = 0;
		}
	    return 1;
    }
    return 0;
}
Reply
#2

Try This

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CARPENTIERE)
    {
        if(response)
        {
            Carpentiere[playerid] = 1;
            ShowInfoForPlayer(playerid,"Hai accettato il lavoro.", 3000);
                            SetPlayerAttachedObject(playerid,4,18635,6,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
            new x = random (2);
            if(x == 0)
            {
                  SetPlayerCheckpoint(playerid, 1280.0118, -1262.7102, 13.5107, 2.0);
            }
            else if(x == 1)
            {
                  SetPlayerCheckpoint(playerid,1280.9083, -1242.0677, 13.9160, 2.0);
            {
            else if(x == 2 || x ==3)
            {
                  SetPlayerCheckpoint(playerid,1268.9485, -1234.4961, 17.0519, 2.0);
            }
            CarCP[playerid] = 1;
        }
        else //this is the error line
        {
            Carpentiere[playerid] = 0;
            ShowInfoForPlayer(playerid,"Hai rifiutato il lavoro.", 3000);
            RemovePlayerAttachedObject(playerid,4);
            DisablePlayerCheckpoint(playerid);
            CarCP[playerid] = 0;
        }
	return 1;
    }
    return 0;
}
Reply
#3

Quote:
Originally Posted by SilverStand
Посмотреть сообщение
Try This

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CARPENTIERE)
    {
        if(response)
        {
            Carpentiere[playerid] = 1;
            ShowInfoForPlayer(playerid,"Hai accettato il lavoro.", 3000);
                            SetPlayerAttachedObject(playerid,4,18635,6,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
            new x = random (2);
            if(x == 0)
            {
            SetPlayerCheckpoint(playerid, 1280.0118, -1262.7102, 13.5107, 2.0);
            }
            if(x == 1)
            {
            SetPlayerCheckpoint(playerid,1280.9083, -1242.0677, 13.9160, 2.0);
            {
            if(x == 2 || x ==3)
            {
            SetPlayerCheckpoint(playerid,1268.9485, -1234.4961, 17.0519, 2.0);
            }
            CarCP[playerid] = 1;
        }
        else //this is the error line
        {
            Carpentiere[playerid] = 0;
            ShowInfoForPlayer(playerid,"Hai rifiutato il lavoro.", 3000);
            RemovePlayerAttachedObject(playerid,4);
            DisablePlayerCheckpoint(playerid);
            CarCP[playerid] = 0;
	    }
	    return 1;
    }
    return 0;
}
Nothing has changed, alternative?
Reply
#4

Just try it
Reply
#5

Код:
            if(x == 1)
            {
            SetPlayerCheckpoint(playerid,1280.9083, -1242.0677, 13.9160, 2.0);
            {
you opened if(x == 1) twice it should be:

PHP код:
            if(== 1)
            {
            
SetPlayerCheckpoint(playerid,1280.9083, -1242.067713.91602.0);
            } 
full code:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_CARPENTIERE)
    {
        if(
response)
        {
            
Carpentiere[playerid] = 1;
            
ShowInfoForPlayer(playerid,"Hai accettato il lavoro."3000);
            
SetPlayerAttachedObject(playerid,4,18635,6,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
            new 
random (2);
            if(
== 0)
            {
            
SetPlayerCheckpoint(playerid1280.0118, -1262.710213.51072.0);
            }
            if(
== 1)
            {
            
SetPlayerCheckpoint(playerid,1280.9083, -1242.067713.91602.0);
            }
            if(
== || ==3)
            {
            
SetPlayerCheckpoint(playerid,1268.9485, -1234.496117.05192.0);
            }
            
CarCP[playerid] = 1;
            }
            else 
//this is the error line
            
{
            
Carpentiere[playerid] = 0;
            
ShowInfoForPlayer(playerid,"Hai rifiutato il lavoro."3000);
            
RemovePlayerAttachedObject(playerid,4);
            
DisablePlayerCheckpoint(playerid);
            
CarCP[playerid] = 0;
        }
        return 
1;
    }
    return 
0;

Reply
#6

Quote:
Originally Posted by Joyeux
Посмотреть сообщение
Nothing has changed, alternative?
You just wrong put the "else" posisition
Reply
#7

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Код:
            if(x == 1)
            {
            SetPlayerCheckpoint(playerid,1280.9083, -1242.0677, 13.9160, 2.0);
            {
you opened if(x == 1) twice it should be:

PHP код:
            if(== 1)
            {
            
SetPlayerCheckpoint(playerid,1280.9083, -1242.067713.91602.0);
            } 
full code:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_CARPENTIERE)
    {
        if(
response)
        {
            
Carpentiere[playerid] = 1;
            
ShowInfoForPlayer(playerid,"Hai accettato il lavoro."3000);
            
SetPlayerAttachedObject(playerid,4,18635,6,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
            new 
random (2);
            if(
== 0)
            {
            
SetPlayerCheckpoint(playerid1280.0118, -1262.710213.51072.0);
            }
            if(
== 1)
            {
            
SetPlayerCheckpoint(playerid,1280.9083, -1242.067713.91602.0);
            }
            if(
== || ==3)
            {
            
SetPlayerCheckpoint(playerid,1268.9485, -1234.496117.05192.0);
            }
            
CarCP[playerid] = 1;
            }
            else 
//this is the error line
            
{
            
Carpentiere[playerid] = 0;
            
ShowInfoForPlayer(playerid,"Hai rifiutato il lavoro."3000);
            
RemovePlayerAttachedObject(playerid,4);
            
DisablePlayerCheckpoint(playerid);
            
CarCP[playerid] = 0;
        }
        return 
1;
    }
    return 
0;

Good, now it works.
Anyway thanks everybody for the help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)