Open Gate Command doesnt Work Properly
#1

Hello Folks, after long time of inactivity i have a Problem, which is driving me Nuts.

I wrote a Command to Open and Close the Police Gates in SF/LV/LS in one Rush but for some odd
Reason, it wont work. I Acctually dont see the Mistake in my Code, also i do not get any Errors
if i Compile it. Well have a Look at it.

Код:
if(strcmp(cmd, "/polizeitor", true) == 0)
	{

 		new TorStatus[256];
	  if(IsPlayerConnected(playerid))
	  {
	    if(gTeam[playerid] == TEAM_COPS)
	    {
				x_nr = strtok(cmdtext, idx);
				
				if(!strlen(x_nr)) {
				  SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor [SF/LS/LV] [Auf/Zu]");
					return 1;
				}
	  			if(strcmp(x_nr,"SF",true) == 0)
					{
			      //tmp = strtok(cmdtext, idx);
			      TorStatus = strtok(cmdtext, idx);
						if(!strlen(TorStatus))
						{
						  SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor SF [Auf/Zu]");
						  return 1;
						}

							if(strcmp(TorStatus,"TorStatus",true) == 0)
							{
							  MoveObject(SFPDTor1, -1571.802246, 670.511292, 6.082452, 1);
								MoveObject(SFPDTor2, -1642.790405, 688.127808, 7.226563, 1);
								MoveObject(SFPDTor3, -1642.790405, 688.127808, 7.226563, 1);
								MoveObject(SFPDTor4, -1642.790405, 688.127808, 7.226563, 1);
							}
							else if(strcmp(TorStatus,"Zu",true) == 0)
							{
							  MoveObject(SFPDTor1, -1571.827271, 661.227234, 6.082452, 1);
								MoveObject(SFPDTor2, -1637.164063, 688.127808, 7.226563, 1);
								MoveObject(SFPDTor3, -1631.689941, 688.141418, 7.226563, 1);
								MoveObject(SFPDTor4, -1626.260010, 688.146851, 7.226563, 1);
							}
					}
	  			else if(strcmp(x_nr,"LS",true) == 0)
					{
			      //tmp = strtok(cmdtext, idx);
			      TorStatus = strtok(cmdtext, idx);
			      
						if(!strlen(TorStatus))
						{
						  SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor LS [Auf/Zu]");
						  return 1;
						}
							
							if(strcmp(TorStatus,"Auf",true) == 0)
							{
								MoveObject(LSPDTor1, 1595.223755, -1637.912109, 13.201916, 1);
								MoveObject(LSPDTor2, 1579.717529, -1637.899292, 13.194120, 1);
							}
							else if(strcmp(TorStatus,"Zu",true) == 0)
							{
								MoveObject(LSPDTor1, 1589.843506, -1637.887085, 13.201916, 1);
								MoveObject(LSPDTor2, 1584.372070, -1637.899292, 13.194120, 1);
							}
					}
	  			else if(strcmp(x_nr,"LV",true) == 0)
					{
			      //tmp = strtok(cmdtext, idx);
			      TorStatus = strtok(cmdtext, idx);
			      
						if(!strlen(tmp))
						{
						  SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor LV [Auf/Zu]");
						  return 1;
						}

							if(strcmp(TorStatus,"Auf",true) == 0)
							{
								MoveObject(LVPDTor1, 2339.367676, 2450.971191, 8.354072, 1);
								MoveObject(LVPDTor2, 2294.408936, 2507.398926, 5.493350, 1);
								MoveObject(LVPDTor3, 2237.288818, 2439.622559, 9.737194, 1);
							}
							else if(strcmp(TorStatus,"Zu",true) == 0)
							{
								MoveObject(LVPDTor1, 2335.233887, 2443.450684, 8.354072, 1);
								MoveObject(LVPDTor2, 2294.408936, 2498.857422, 5.493350, 1);
								MoveObject(LVPDTor3, 2237.453613, 2448.817139, 9.648535, 1);
							}
					}
  	    }else{
      SendClientMessage(playerid, COLOR_GREY, " * Du darfst diesen Befehl nicht benutzen!");
      return 1;
	    }
	  }
	  return 1;
	}
regards
The_Don
Reply
#2

Try this (Not Tested):
pawn Код:
if(strcmp(cmd, "/polizeitor", true) == 0)
    {
        new TorStatus[256];
        new x_nr[256];
      if(IsPlayerConnected(playerid))
      {
        if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_CSI)
        {
                x_nr = strtok(cmdtext, idx);

                if(!strlen(x_nr))
                {
                  SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor [SF/LS/LV] [Auf/Zu]");
                    return 1;
                }
                if(strcmp(x_nr,"SF",true) == 0)
                {
                //tmp = strtok(cmdtext, idx);
                TorStatus = strtok(cmdtext, idx);
                    if(!strlen(TorStatus))
                    {
                    SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor SF [Auf/Zu]");
                      return 1;
                    }
                    if(strcmp(TorStatus,"Auf",true) == 0)
                    {
                    MoveObject(SFPDTor1, -1571.802246, 670.511292, 6.082452, 1);
                        MoveObject(SFPDTor2, -1642.790405, 688.127808, 7.226563, 1);
                        MoveObject(SFPDTor3, -1642.790405, 688.127808, 7.226563, 1);
                        MoveObject(SFPDTor4, -1642.790405, 688.127808, 7.226563, 1);
                    }
                    else if(strcmp(TorStatus,"Zu",true) == 0)
                    {
                        MoveObject(SFPDTor1, -1571.827271, 661.227234, 6.082452, 1);
                        MoveObject(SFPDTor2, -1637.164063, 688.127808, 7.226563, 1);
                        MoveObject(SFPDTor3, -1631.689941, 688.141418, 7.226563, 1);
                        MoveObject(SFPDTor4, -1626.260010, 688.146851, 7.226563, 1);
                    }
                }
                else if(strcmp(x_nr,"LS",true) == 0)
                {
                //tmp = strtok(cmdtext, idx);
                TorStatus = strtok(cmdtext, idx);
                    if(!strlen(TorStatus))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor LS [Auf/Zu]");
                        return 1;
                    }
                    if(strcmp(TorStatus,"Auf",true) == 0)
                    {
                        MoveObject(LSPDTor1, 1595.223755, -1637.912109, 13.201916, 1);
                        MoveObject(LSPDTor2, 1579.717529, -1637.899292, 13.194120, 1);
                    }
                    else if(strcmp(TorStatus,"Zu",true) == 0)
                    {
                        MoveObject(LSPDTor1, 1589.843506, -1637.887085, 13.201916, 1);
                        MoveObject(LSPDTor2, 1584.372070, -1637.899292, 13.194120, 1);
                    }
                }
                else if(strcmp(x_nr,"LV",true) == 0)
                {
                //tmp = strtok(cmdtext, idx);
                TorStatus = strtok(cmdtext, idx);
                    if(!strlen(TorStatus))
                    {
                      SendClientMessage(playerid, COLOR_WHITE, " * BENUTZUNG: /polizeitor LV [Auf/Zu]");
                      return 1;
                    }
                    if(strcmp(TorStatus,"Auf",true) == 0)
                    {
                        MoveObject(LVPDTor1, 2339.367676, 2450.971191, 8.354072, 1);
                        MoveObject(LVPDTor2, 2294.408936, 2507.398926, 5.493350, 1);
                        MoveObject(LVPDTor3, 2237.288818, 2439.622559, 9.737194, 1);
                    }
                    else if(strcmp(TorStatus,"Zu",true) == 0)
                    {
                        MoveObject(LVPDTor1, 2335.233887, 2443.450684, 8.354072, 1);
                        MoveObject(LVPDTor2, 2294.408936, 2498.857422, 5.493350, 1);
                        MoveObject(LVPDTor3, 2237.453613, 2448.817139, 9.648535, 1);
                    }
                }
            }
            else
            {
        SendClientMessage(playerid, COLOR_GREY, " * Du darfst diesen Befehl nicht benutzen!");
        return 1;
            }
      }
      return 1;
    }
Reply
#3

Thanks Mate! It Works now! But i want it for 3 Teams, so i used this Variable:

Код:
if(gTeam[playerid] == TEAM_COPS || TEAM_FBI || TEAM_CSI)
If i use it with this, it wont work, and i dont know where the Issue is :S
Reply
#4

Quote:
Originally Posted by Adtec_244
Thanks Mate! It Works now! But i want it for 3 Teams, so i used this Variable:

Код:
if(gTeam[playerid] == TEAM_COPS || TEAM_FBI || TEAM_CSI)
If i use it with this, it wont work, and i dont know where the Issue is :S
try
Код:
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_CSI)
Reply
#5

Thanks Mate! Now it Works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)