[HELP]Command not working
#1

Ok when i do /duty when im a fbi it says im not a cop i edited still please help me thanks
Код:
	if(strcmp(cmd, "/duty", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			{
				if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875)||PlayerToPoint(3,playerid,2729.6565,-2451.3530,17.5937)||PlayerToPoint(3,playerid,300.8975,187.0387,1007.1719))
        {

					if(OnDuty[playerid]==0)
			    {
			      if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
			      {
				  		format(string, sizeof(string), "* Officer %s took a Badge and a Gun from his locker.", sendername);
						}
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SafeGivePlayerWeapon(playerid, 24, 70);
						SafeGivePlayerWeapon(playerid, 3, 0);
						SetPlayerArmour(playerid, 100);
						OnDuty[playerid] = 1;
						SetPlayerColor(playerid,TEAM_BLUE_COLOR);
					}
					else if(PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2)
			      {
				  		format(string, sizeof(string), "* Agent %s took a Badge and a Gun from his locker.", sendername);
						}
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SafeGivePlayerWeapon(playerid, 24, 70);
						SafeGivePlayerWeapon(playerid, 3, 0);
						SetPlayerArmour(playerid, 100);
						OnDuty[playerid] = 1;
						SetPlayerColor(playerid,TEAM_BLUE_COLOR);
					}
					else if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
			      {
				  		format(string, sizeof(string), "* Major %s took a Badge and a Gun from his locker.", sendername);
						}
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SafeGivePlayerWeapon(playerid, 24, 900);
						SafeGivePlayerWeapon(playerid, 45, 900);
						SafeGivePlayerWeapon(playerid, 30, 0);
						SetPlayerArmour(playerid, 100);
						OnDuty[playerid] = 1;
					}
					else if(OnDuty[playerid]==1)
					{
					  if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
					  {
							format(string, sizeof(string), "* Officer %s places his Badge and Gun in his locker.", sendername);
						}
						else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
						{
						  format(string, sizeof(string), "* Agent %s places his Badge and Gun in his locker.", sendername);
						}
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						SafeResetPlayerWeapons(playerid);
						SetPlayerArmour(playerid, 0);
						SafeGivePlayerWeapon(playerid, 41, 500);
						OnDuty[playerid] = 0;
						}
						}



				else
				{
					SendClientMessage(playerid, COLOR_GRAD2, "  You are not in a locker room !");
					return 1;
					}

			if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
			{
			  if(JobDuty[playerid] == 1)
			  {
			    SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Medic Job and will not receive calls anymore.");
			    JobDuty[playerid] = 0;
			    Medics -= 1;
			  }
			  else
			  {
			    SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Medic Job and will receive calls from people in need.");
			    JobDuty[playerid] = 1;
			    Medics += 1;
			    GetPlayerName(playerid,sendername,sizeof(sendername));
  					format(string, sizeof(string), "[Advert] Paramedic %s is On Duty, /call 911.", sendername);
	  			OOCNews(COLOR_ALLDEPT,string);
			  }
			}
			else if(PlayerInfo[playerid][pJob] == 17)
  			{
    			if(JobDuty[playerid] == 1)
    			{
      			SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Pizza Delivery Job and will not receive calls anymore.");
      			JobDuty[playerid] = 0;
      			PizzaBoys -= 1;
    			}
    			else
    			{
      			SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Pizza Delivery Job and will receive calls from people in need.");
      			JobDuty[playerid] = 1;
    			PizzaBoys += 1;
    			GetPlayerName(playerid,sendername,sizeof(sendername));
  					format(string, sizeof(string), "[Advert] Well stacked pizza worker %s is now On Duty, /call 111 to order a pizza.", sendername);
	  			OOCNews(0xFF7E00AA,string);
				}
			}
			else if(PlayerInfo[playerid][pJob] == 7)
			{
			  if(JobDuty[playerid] == 1)
			  {
			    SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Car Mechanic Job and will not receive calls anymore.");
			    JobDuty[playerid] = 0;
			    Mechanics -= 1;
			  }
			  else
			  {
			    SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Car Mechanic Job and will receive calls from people in need.");
			    JobDuty[playerid] = 1;
			    Mechanics += 1;
			    GetPlayerName(playerid,sendername,sizeof(sendername));
  					format(string, sizeof(string), "[Advert] Car mechanic %s is now On Duty, /call 555 to call a mechanic.", sendername);
	  			OOCNews(0x2993EDAA,string);
				  }
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GRAD1, "  You are not a Cop !");
			}
		}
		return 1;
	}
Reply
#2

lol
Reply
#3

Quote:
Originally Posted by Lilcuete
lol
you did it wrong, this is saying that if the player is in Faction 1,2 and 3 and is leader. if you want them all then try doing if(PlayerInfo[playerid][pCop] == 1)
define the pCop and make it for all 3 factions and then go ahead
Reply
#4

If i am not wrong this GM has a IsPlayerCop(playerid), try to use it
Reply
#5

Still dont work
Reply
#6

pawn Код:
if(strcmp(cmd, "/duty", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new pm=PlayerInfo[playerid][pMember];
        new pi=PlayerInfo[playerid][pMember];
        if((pm>0&&pm<4)&&(pi>0&&pi<4))
        {
            if(!PlayerToPoint(3, playerid,255.3,77.4,1003.6))return SendClientMessage(playerid,COLOR_GRAD2,"  You are not in a locker room !");
            if(!PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875))return SendClientMessage(playerid,COLOR_GRAD2,"  You are not in a locker room !");
            if(!PlayerToPoint(3,playerid,2729.6565,-2451.3530,17.5937))return SendClientMessage(playerid,COLOR_GRAD2,"  You are not in a locker room !");
            if(!PlayerToPoint(3,playerid,300.8975,187.0387,1007.1719))return SendClientMessage(playerid,COLOR_GRAD2,"  You are not in a locker room !");
            if(OnDuty[playerid]==0)
            {
                if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                {
                    format(string, sizeof(string), "* Officer %s took a Badge and a Gun from his locker.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SafeGivePlayerWeapon(playerid, 24, 70);
                    SafeGivePlayerWeapon(playerid, 3, 0);
                    SetPlayerArmour(playerid, 100);
                    OnDuty[playerid] = 1;
                    SetPlayerColor(playerid,TEAM_BLUE_COLOR);
                    return 1;
                }
                else if(PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 2)
                {
                    format(string, sizeof(string), "* Agent %s took a Badge and a Gun from his locker.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SafeGivePlayerWeapon(playerid, 24, 70);
                    SafeGivePlayerWeapon(playerid, 3, 0);
                    SetPlayerArmour(playerid, 100);
                    OnDuty[playerid] = 1;
                    SetPlayerColor(playerid,TEAM_BLUE_COLOR);
                    return 1;
                }
                else if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3)
                {
                    format(string, sizeof(string), "* Major %s took a Badge and a Gun from his locker.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SafeGivePlayerWeapon(playerid, 24, 900);
                    SafeGivePlayerWeapon(playerid, 45, 900);
                    SafeGivePlayerWeapon(playerid, 30, 0);
                    SetPlayerArmour(playerid, 100);
                    OnDuty[playerid] = 1;
                    return 1;
                }
            }
            else if(OnDuty[playerid]==1)
            {
                if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
                {format(string, sizeof(string), "* Officer %s places his Badge and Gun in his locker.", sendername);}
                else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
                {format(string, sizeof(string), "* Agent %s places his Badge and Gun in his locker.", sendername);}
                else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
                {format(string, sizeof(string), "* Major %s places his Badge and Gun in his locker.", sendername);}
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                SafeResetPlayerWeapons(playerid);
                SetPlayerArmour(playerid, 0);
                SafeGivePlayerWeapon(playerid, 41, 500);
                OnDuty[playerid] = 0;
                return 1;
            }
        }
        if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
        {
            if(JobDuty[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Medic Job and will not receive calls anymore.");
                JobDuty[playerid] = 0;
                Medics -= 1;
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Medic Job and will receive calls from people in need.");
                JobDuty[playerid] = 1;
                Medics += 1;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                format(string, sizeof(string), "[Advert] Paramedic %s is On Duty, /call 911.", sendername);
                OOCNews(COLOR_ALLDEPT,string);
                return 1;
            }
        }
        if(PlayerInfo[playerid][pJob] == 17)
        {
            if(JobDuty[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Pizza Delivery Job and will not receive calls anymore.");
                JobDuty[playerid] = 0;
                PizzaBoys -= 1;
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Pizza Delivery Job and will receive calls from people in need.");
                JobDuty[playerid] = 1;
                PizzaBoys += 1;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                format(string, sizeof(string), "[Advert] Well stacked pizza worker %s is now On Duty, /call 111 to order a pizza.", sendername);
                OOCNews(0xFF7E00AA,string);
                return 1;
            }
        }
        if(PlayerInfo[playerid][pJob] == 7)
        {
            if(JobDuty[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now Off Duty from your Car Mechanic Job and will not receive calls anymore.");
                JobDuty[playerid] = 0;
                Mechanics -= 1;
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "* You are now On Duty with your Car Mechanic Job and will receive calls from people in need.");
                JobDuty[playerid] = 1;
                Mechanics += 1;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                format(string, sizeof(string), "[Advert] Car mechanic %s is now On Duty, /call 555 to call a mechanic.", sendername);
                OOCNews(0x2993EDAA,string);
                return 1;
            }
        }
    }
    SendClientMessage(playerid, COLOR_GRAD1, "  You are not a Cop !");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)