SA-MP Forums Archive
SetPlayerTeam bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerTeam bug (/showthread.php?tid=140813)



SetPlayerTeam bug - adytzu32 - 10.04.2010

what's wrong with this commands? http://pastebin.com/YUKHMAcg but when i type /changeballas no effect



Re: SetPlayerTeam bug - Joe_ - 10.04.2010

pawn Код:
if(strcmp(cmdtext, "/changeaztecas", true) == 0)
  {
        if(gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_BALLAS || gTeam[playerid] == TEAM_COP)
    {
      SetPlayerTeam(playerid, 5);
      return 1;
    }
  }
  if(strcmp(cmdtext, "/changecops", true) == 0)
  {
        if(gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_BALLAS)
    {
      SetPlayerTeam(playerid, 3);
      return 1;
    }
  }
  if(strcmp(cmdtext, "/changeballas", true) == 0)
  {
        if(gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_COP)
    {
      SetPlayerTeam(playerid, 2);
      return 1;
    }
  }
  if(strcmp(cmdtext, "/changeitalian", true) == 0)
  {
        if(gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_BALLAS || gTeam[playerid] == TEAM_COP)
    {
      SetPlayerTeam(playerid, 4);
      return 1;
    }
  }
  if(strcmp(cmdtext, "/changegrove", true) == 0)
  {
        if(gTeam[playerid] == TEAM_BALLAS || gTeam[playerid] == TEAM_COP)
    {
      SetPlayerTeam(playerid, 1);
      return 1;
    }
  }
Ok should work, you have more than one instance of the same command, you only need one, you can place more than one check in one if() statement using the "||" "&&" thingies.



Re: SetPlayerTeam bug - adytzu32 - 10.04.2010

doesn't work with "||"


Re: SetPlayerTeam bug - Torran - 10.04.2010

Why do you check the players team using gTeam but then set it using SetPlayerTeam?


Re: SetPlayerTeam bug - adytzu32 - 10.04.2010

and what function should i use?


Re: SetPlayerTeam bug - Torran - 10.04.2010

Quote:
Originally Posted by adytzu32
and what function should i use?
Well you can either get the players team using gTeam and set it using gTeam
Or you can get the players team using GetPlayerTeam and set it using SetPlayerTeam