need help with a command
#1

ok, i got a /gov command that kinda works. but it says "You Are Not A FBI Agent" even when they are
Код:
	if(strcmp(cmd, "/gov", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
			{
    		SendClientMessage(playerid, COLOR_GREY, "  You Not A FBI Agent !");
    		return 1;
			}
			if(PlayerInfo[playerid][pRank] < 5)
			{
			  SendClientMessage(playerid, COLOR_GREY, "  You need to be Rank 5 to be able to use this !");
			  return 1;
			}
			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: (/gov)ernment [text]");
				return 1;
			}
			SendClientMessageToAll(COLOR_WHITE, "|___________ Government News Announcement ___________|");
			format(string, sizeof(string), "Goverment Offical %s: %s", sendername, result);
			SendClientMessageToAll(COLOR_DBLUE, string);
 			}
		return 1;
	}
i thought it was
Код:
			if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
			{
    		SendClientMessage(playerid, COLOR_GREY, "  You Not A FBI Agent !");
    		return 1;
			}
and i tried removing that, and gave me abunch of errors
Reply
#2

change
if(PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==2)
to
if(PlayerInfo[playerid][pLeader]!=2||PlayerInfo[playerid][pMember]!=2)

== is equal
!= not equal

Reply
#3

I think he should use

pawn Код:
if(PlayerInfo[playerid][pLeader] != 2 && PlayerInfo[playerid][pMember] != 2)
Reply
#4

ok, i tried both of those codes, and it comes up with the same thing

EDIT:
nevermind
i used the last suggestion and put a else before the next code
Код:
			if(PlayerInfo[playerid][pLeader]!=2 && PlayerInfo[playerid][pMember]!=2)
			{
		 	SendClientMessage(playerid, COLOR_GREY, "  You Not A FBI Agent !");
    		return 1;
			}
			else if(PlayerInfo[playerid][pRank] < 5)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)