[HELP]/suspect command not working
#1

ok when i do /suspect and im on duty it says im not on duty heres my command
Код:
//----------------------------------[SetCrim]-----------------------------------------------
		if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
		  if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
			{
			  SendClientMessage(playerid, COLOR_GREY, "  You are not on Duty!");
			  return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime discription]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (gTeam[playerid] == 2 || IsACop(playerid))
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						if (gTeam[giveplayerid] != 2)
						{
							GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							new length = strlen(cmdtext);
							while ((idx < length) && (cmdtext[idx] <= ' '))
							{
								idx++;
							}
							new offset = idx;
							new result[64];
							while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
							{
								result[idx - offset] = cmdtext[idx];
								idx++;
							}
							result[idx - offset] = EOS;
							if(!strlen(result))
							{
								SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
								return 1;
							}
							if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 3; }
							else { WantedPoints[giveplayerid]+= 2; }
							SetPlayerCriminal(giveplayerid,playerid, result);
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD2, "  You can't suspect a Cop !");
						}
					}
				}
				else
				{
						format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  You are not a Cop / FBI / National Guard !");
			}
		}
		return 1;
	}
Please tell me wats wrong thanks
Reply
#2

pawn Код:
//----------------------------------[SetCrim]-----------------------------------------------
        if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
          if(!OnDuty[playerid] == 1 && PlayerInfo[playerid][pMember] == 1)
            {
              SendClientMessage(playerid, COLOR_GREY, "  You are not on Duty!");
              return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime discription]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (gTeam[playerid] == 2 || IsACop(playerid))
            {
                if(IsPlayerConnected(giveplayerid))
                {
                  if(giveplayerid != INVALID_PLAYER_ID)
                  {
                        if (gTeam[giveplayerid] != 2)
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            new length = strlen(cmdtext);
                            while ((idx < length) && (cmdtext[idx] <= ' '))
                            {
                                idx++;
                            }
                            new offset = idx;
                            new result[64];
                            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                            {
                                result[idx - offset] = cmdtext[idx];
                                idx++;
                            }
                            result[idx - offset] = EOS;
                            if(!strlen(result))
                            {
                                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
                                return 1;
                            }
                            if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 3; }
                            else { WantedPoints[giveplayerid]+= 2; }
                            SetPlayerCriminal(giveplayerid,playerid, result);
                            return 1;
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "  You can't suspect a Cop !");
                        }
                    }
                }
                else
                {
                        format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
                        SendClientMessage(playerid, COLOR_GRAD1, string);
                        return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  You are not a Cop / FBI / National Guard !");
            }
        }
        return 1;
    }
Guess, not tested, but it should work, report back here if any problems, etc.
Reply
#3

Thanks, i have been looking for a suspect command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)