warning 209: return value
#1

C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\serv\pawno\test.p wn(3713) : warning 209: function "OnPlayerCommandsText" should return a value

return 1;
}
}
}
}
} < 3713
Reply
#2

Quote:
Originally Posted by SuperS0nic
C:\DOCUME~1\17FE8~1.MRK\SKRIVB~1\serv\pawno\test.p wn(3713) : warning 209: function "OnPlayerCommandsText" should return a value

return 1;
}
}
}
}
} < 3713
That's incredibly helpful.....

Maybe post a bit more of the code?
Reply
#3

Check you have return 0; At the end of OnPlayerCommandText. That really does not help without the rest of the code.
Reply
#4

Код:
  if(strcmp(cmd, "/911", true) == 0) {
  if(IsSpawned[playerid] == 0) {
	SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
  return 1;
  }
  if(Jailed[playerid] ==1) {
  SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
  return 1;
  }
  if(InDerby[playerid] == 1) {
  SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
  return 1;
  }
  if(gTeam[playerid] <= 2) {
  SendClientMessage(playerid,COLOR_ERROR,"You are a Law Enforcement officer. You cannot call /911 ");
  return 1;
  }
  if (!GetPlayersInTeam(TEAM_COPS)) {
  SendClientMessage(playerid,COLOR_ERROR,"There are no Police officers in the area");
  return 1;
  }

  new output[70];
  strmid(output,cmdtext,5,strlen(cmdtext));
  if(strlen(cmdtext) <= 4) {
  SendClientMessage(playerid, 0xA9A9A9AA, "USAGE: /911 (message)");
  return 1;
  }
  SendClientMessage(playerid, 0xA9A9A9AA, "|_Dialed 911_|");
	SendClientMessage(playerid,0x00C7FFAA,"You have dialed 911 - Please wait for Police assistance");
  new callername[30];
  GetPlayerName(playerid,callername, 30);
  new current_zone;
  current_zone = player_zone[playerid];
  for(new i=0;i<MAX_PLAYERS;i++)
	{
  if(LawEnforcementRadio[i] == 1) {
  format(string, sizeof(string), "DISPATCH: (911) %s(%d) has called 911",callername,playerid);
  SendClientMessage(i,COLOR_ROYALBLUE,string);
  format(string, sizeof(string), "%s(%d) Said: ( %s )",callername,playerid,output);
  SendClientMessage(i,COLOR_ROYALBLUE,string);
  format(string, sizeof(string), "All units in the area please respond. Location: %s",zones[current_zone][zone_name]);
  SendClientMessage(i,COLOR_ROYALBLUE,string);
 		 return 1;
  }
}
}
}
}
Reply
#5

Like ♦۞pкћп§-шŧųĄ۞♦ told, before the last bracket put return 0;
Reply
#6

Read pawn doc
Reply
#7

i moved everything to the last part of the code and now it says:
error 030: compound statement not closed at the end of file (started at line 3687)
3687:
Код:
new string[256];
The beginning:
Код:
public OnPlayerCommandsText(playerid, cmdtext[])
{
new string[256];
new cmd[256];
new giveplayerid, idx;
new tmp[256];


	cmd = strtok(cmdtext, idx);
 if(strcmp(cmd, "/heal", true) == 0) {
  if(IsSpawned[playerid] == 0) {
	SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
  return 1;
  }
  if(Jailed[playerid] == 1) {
	SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
  return 1;
  }
  if(gTeam[playerid] != TEAM_MEDIC) {
  SendClientMessage(playerid,COLOR_ERROR,"You are not a medic");
  return 1;
  }
  if(InDerby[playerid] == 1) {
  SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
  return 1;
  }
  tmp = strtok(cmdtext, idx);
  if(!strlen(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /heal (id)");
  return 1;
  }
  giveplayerid = strval(tmp);
  if(!IsNumeric(tmp)) {
  SendClientMessage(playerid, COLOR_ERROR, "USAGE: /heal (id) ID Must be a number");
  return 1;
  }
  new mname[24];
  new pname[24];
  GetPlayerName(playerid,mname, 24);
	GetPlayerName(giveplayerid, pname, 24);
	if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5) {
   format(string, sizeof(string), "%s(%d) Is not close enough. You cannot heal that player",pname,giveplayerid);
   SendClientMessage(playerid, COLOR_ERROR, string);
   return 1;
   }
	if(wantsheal[giveplayerid] == 0) {
	format(string, sizeof(string), "Medic %s(%d) has attempted to heal you. Type /medic if you need a Medic",mname,playerid);
  SendClientMessage(giveplayerid,COLOR_FORESTGREEN, string);
  format(string, sizeof(string), "%s(%d) has not asked for a medic. You cannot heal that player", pname,giveplayerid);
  SendClientMessage(playerid,COLOR_ERROR, string);
  }
  else
  if(wantsheal[giveplayerid] == 1) {
  new mrand = random(3500);
  oscore = GetPlayerScore(playerid);
  SendClientMessage(giveplayerid,0xA9A9A9AA, "|_Health Restored_|");
  format(string, sizeof(string), "Medic %s(%d) has healed you for $%d",mname,playerid,mrand);
  SendClientMessage(giveplayerid,COLOR_FORESTGREEN, string);
  SendClientMessage(playerid,0xA9A9A9AA, "|_Player Health Restored_|");
  format(string, sizeof(string), "%s(%d) has been healed. You earned $%d", pname,giveplayerid,mrand);
  SendClientMessage(playerid,COLOR_FORESTGREEN, string);
  SetPlayerHealth(giveplayerid,100);
  GivePlayerMoney(giveplayerid,-mrand);
  GivePlayerMoney(playerid,mrand);
  SetPlayerScore(playerid, oscore +1);
  wantsheal[giveplayerid] =0;
  }
  return 1;
  }
ETC ETC.
Reply
#8

Quote:
Originally Posted by 0rb
Read pawn doc
Reply
#9

link?
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmd, "/911", true) == 0)
    {
    if(IsSpawned[playerid] == 0)
     {
        SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
        return 1;
     }
    if(Jailed[playerid] ==1)
     {
        SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
        return 1;
     }
    if(InDerby[playerid] == 1)
     {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command while you are in the stadium");
         return 1;
     }
    if(gTeam[playerid] <= 2)
     {
        SendClientMessage(playerid,COLOR_ERROR,"You are a Law Enforcement officer. You cannot call /911 ");
        return 1;
     }
    if (!GetPlayersInTeam(TEAM_COPS))
     {
        SendClientMessage(playerid,COLOR_ERROR,"There are no Police officers in the area");
        return 1;
     }

    new output[70];
    strmid(output,cmdtext,5,strlen(cmdtext));

    if(strlen(cmdtext) <= 4)
     {
        SendClientMessage(playerid, 0xA9A9A9AA, "USAGE: /911 (message)");
        return 1;
     }

    SendClientMessage(playerid, 0xA9A9A9AA, "|_Dialed 911_|");
    SendClientMessage(playerid,0x00C7FFAA,"You have dialed 911 - Please wait for Police assistance");
    new callername[30];
    GetPlayerName(playerid,callername, 30);
    new current_zone;
    current_zone = player_zone[playerid];

    for(new i=0;i<MAX_PLAYERS;i++)
      {
      if(LawEnforcementRadio[i] == 1)
        {
          format(string, sizeof(string), "DISPATCH: (911) %s(%d) has called 911",callername,playerid);
          SendClientMessage(i,COLOR_ROYALBLUE,string);
          format(string, sizeof(string), "%s(%d) Said: ( %s )",callername,playerid,output);
          SendClientMessage(i,COLOR_ROYALBLUE,string);
          format(string, sizeof(string), "All units in the area please respond. Location: %s",zones[current_zone][zone_name]);
          SendClientMessage(i,COLOR_ROYALBLUE,string);
          return 1;
        }
      }
    }
  return 0;
}
I am not saying you code is right but I had to look through the indentions.

[EDIT] I just seen the rest of that code you posted sorry mate but I am not gonna search through that also. If I was you I would look at the layout of your code its hard to read mate and must be for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)