SA-MP Forums Archive
Again I need help. - 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: Again I need help. (/showthread.php?tid=251077)



Again I need help. - Cjgogo - 25.04.2011

Here's the improved version of the team colors:

pawn Код:
#define TEAM_ROBBERS 8
#define TEAM_COPS 9

public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerTeamFromClass(playerid, classid);
    SetPlayerPos(playerid, -2556.3979,1217.2249,42.1484);
    SetPlayerFacingAngle(playerid,9.1927);
    SetPlayerCameraPos(playerid, -2556.9431,1224.0414,42.1484);
    SetPlayerCameraLookAt(playerid,-2556.3979,1217.2249,42.1484);

    return 1;
}



public OnPlayerSpawn(playerid)
{
        SetPlayerToTeamColor(playerid);//Line 188
    return 1;
}

SetPlayerTeamFromClass(playerid,classid)
{
   new gTeam[MAX_PLAYERS];
   switch(classid)
   {
      case 0:
      {
             if(classid == 98)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
      }
      case 1:
      {
             if(classid == 100)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
       }
      case 2:
      {
              if(classid == 101)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
      }
      case 3:
      {
              if(classid == 284)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
      case 4:
      {
              if(classid == 285)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
      case 5:
      {
              if(classid == 286)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
   }
}

SetPlayerToTeamColor(playerid,classid)
{
   new gTeam[MAX_PLAYERS];
   if(gTeam[playerid] == TEAM_ROBBERS)
   {
      SetPlayerColor(playerid,WHITE);
   }
   else if(gTeam[playerid] == TEAM_COPS)
   {
      SetPlayerColor(playerid,BLUE);
   }
}

             
SetPlayerTeamFromClass(playerid,classid)
{
   new gTeam[MAX_PLAYERS];
   switch(classid)
   {
      case 0:
      {
             if(classid == 98)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
      }
      case 1:
      {
             if(classid == 100)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
       }
      case 2:
      {
              if(classid == 101)
              {
                 gTeam[playerid] = TEAM_ROBBERS;
              }
      }
      case 3:
      {
              if(classid == 284)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
      case 4:
      {
              if(classid == 285)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
      case 5:
      {
              if(classid == 286)
              {
                 gTeam[playerid] = TEAM_COPS;
              }
      }
   }
}

SetPlayerToTeamColor(playerid,classid) //Line 828
{
   new gTeam[MAX_PLAYERS];
   if(gTeam[playerid] == TEAM_ROBBERS)
   {
      SetPlayerColor(playerid,WHITE);
   }
   else if(gTeam[playerid] == TEAM_COPS)
   {
      SetPlayerColor(playerid,BLUE);
   }
}
2 warnings when compiling:
Код:
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\lsdm.pwn(188) : warning 202: number of arguments does not match definition
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\lsdm.pwn(828) : warning 203: symbol is never used: "classid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
How to solve the warnings(and I went to game but still not working)


Re: Again I need help. - aircombat - 25.04.2011

i don't think that code works , if u have skype , xfire pm me and i'll give u a working one


Re: Again I need help. - xir - 25.04.2011

What have you done with the code I gave? You messed it up


Re: Again I need help. - Cjgogo - 26.04.2011

Your code was also not working xir


Re: Again I need help. - xDeadlyBoy - 26.04.2011

the problem is the function SetPlayerToTeamColor, you added a parameter and didn't used it:
pawn Код:
SetPlayerToTeamColor(playerid) //Line 828
{
   new gTeam[MAX_PLAYERS];
   if(gTeam[playerid] == TEAM_ROBBERS)
   {
      SetPlayerColor(playerid,WHITE);
   }
   else if(gTeam[playerid] == TEAM_COPS)
   {
      SetPlayerColor(playerid,BLUE);
   }
}