Error 055: start of function body without function header
#1

Hi guys, I have this error: "start of function body without function header".
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
         if (strcmp("/jobs", cmdtext, true, 10) == 0)
	{
		if(CanJob[playerid] == 1)return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: {FFFFFF}You can only do a job each 2 minutes.");
		if(InJob[playerid] > 0)return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: {FFFFFF}You're already in a job.");
		ShowJobs(playerid);
		SendClientMessage(playerid, COLOR_LIGHTRED, "JOBS: {FFFFFF}Choose the job by clicking it!");
		return 1;
	}
	return 0;
}
{
	if (strcmp("/pizza", cmdtext, true, 10) == 0)
	{
               if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
      	       {
      	              PizzaJob[playerid] = 1;
                      SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
	              SendClientMessage(playerid, COLOR_LIGHTRED,"* Segui i checkpoint per ricevere la paga!");
	              return 1;
	        }
                SendClientMessage(playerid, COLOR_LIGHTRED,"Devi essere sul Pizzaboy per lavorare!");
         }
	return 0;
}
The error is on the line with the open bracket before "if (strcmp("/pizza", cmdtext, true, 10) == 0)"

How to fix it? Thanks all!
Reply
#2

You've added two extra brackets. Solution:

Quote:
Originally Posted by FreddiewJO
Посмотреть сообщение
Hi guys, I have this error: "start of function body without function header".
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/jobs", cmdtext, true, 10) == 0)
	{
		if(CanJob[playerid] == 1)return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: {FFFFFF}You can only do a job each 2 minutes.");
		if(InJob[playerid] > 0)return SendClientMessage(playerid, COLOR_LIGHTRED, "ERROR: {FFFFFF}You're already in a job.");
		ShowJobs(playerid);
		SendClientMessage(playerid, COLOR_LIGHTRED, "JOBS: {FFFFFF}Choose the job by clicking it!");
		return 1;
	}
        if (strcmp("/pizza", cmdtext, true, 10) == 0)
	{
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
      	    {
      	        PizzaJob[playerid] = 1;
                SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
	        SendClientMessage(playerid, COLOR_LIGHTRED,"* Segui i checkpoint per ricevere la paga!");
	        return 1;
	    }
            SendClientMessage(playerid, COLOR_LIGHTRED,"Devi essere sul Pizzaboy per lavorare!");
	 }
	return 0;
}
The error is on the line with the open bracket before "if (strcmp("/pizza", cmdtext, true, 10) == 0)"

How to fix it? Thanks all!
Reply
#3

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
         if (
strcmp("/jobs"cmdtexttrue10) == 0)
    {
        if(
CanJob[playerid] == 1)return SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: {FFFFFF}You can only do a job each 2 minutes.");
        if(
InJob[playerid] > 0)return SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: {FFFFFF}You're already in a job.");
        
ShowJobs(playerid);
        
SendClientMessage(playeridCOLOR_LIGHTRED"JOBS: {FFFFFF}Choose the job by clicking it!");
        return 
1;
    }
    return 
0;
}
//Why this bracket ?
    
if (strcmp("/pizza"cmdtexttrue10) == 0)
    {
               if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
                 {
                        
PizzaJob[playerid] = 1;
                      
SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
                  
SendClientMessage(playeridCOLOR_LIGHTRED,"* Segui i checkpoint per ricevere la paga!");
                  return 
1;
            }
                
SendClientMessage(playeridCOLOR_LIGHTRED,"Devi essere sul Pizzaboy per lavorare!");
         }
    return 
0;

Correction :

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
         if (
strcmp("/jobs"cmdtexttrue10) == 0)
    {
        if(
CanJob[playerid] == 1)return SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: {FFFFFF}You can only do a job each 2 minutes.");
        if(
InJob[playerid] > 0)return SendClientMessage(playeridCOLOR_LIGHTRED"ERROR: {FFFFFF}You're already in a job.");
        
ShowJobs(playerid);
        
SendClientMessage(playeridCOLOR_LIGHTRED"JOBS: {FFFFFF}Choose the job by clicking it!");
        return 
1;
    }
    return 
0;
}
    if (
strcmp("/pizza"cmdtexttrue10) == 0)
    {
               if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
                 {
                        
PizzaJob[playerid] = 1;
                      
SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
                  
SendClientMessage(playeridCOLOR_LIGHTRED,"* Segui i checkpoint per ricevere la paga!");
                  return 
1;
            }
                
SendClientMessage(playeridCOLOR_LIGHTRED,"Devi essere sul Pizzaboy per lavorare!");
         }
    return 
0;

KillerDVX,
Reply
#4

Both are missing bracket guys. However I fix it, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)