Colour problem
#1

guys i tried to change to teams colour but what happend is that all the teams have changed chat colour to green why ?

Код:
public OnPlayerSpawn(playerid)
{

  SetPlayerTeam(playerid, 1);
  SetPlayerColor(playerid, 0x95DFECFF);

	SetPlayerTeam(playerid, 2);
	SetPlayerColor(playerid, 0x33AA33AA);

  
  return 1;
}
Edit:

when i tried to fix with this:
Код:
#define TEAM_1
#define TEAM_2
Код:
new gTeam[MAX_PLAYERS];

if(gTeam[playerid] == TEAM_1) { //line 40

  SetPlayerTeam(playerid, 1);
  SetPlayerColor(playerid, 0x95DFECFF);
  }
  
else if(gTeam[playerid] == TEAM_2) { //line 46

	SetPlayerTeam(playerid, 2);
	SetPlayerColor(playerid, 0x33AA33AA);
	}
  
return 1;
}
it by my self this errors happend:

Код:
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\example.pwn(40) : error 029: invalid expression, assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\gamemodes\example.pwn(46) : error 029: invalid expression, assumed zero
Reply
#2

Okay, this is untested, but try it:


At top of your GM
pawn Код:
new Team;

and this is the OnPlayerSpawn

pawn Код:
public OnPlayerSpawn(playerid)
{

        {
        switch (Team)
                {
      case 0: {  SetPlayerTeam(playerid, 1);
                    SetPlayerColor(playerid, 0x95DFECFF);
                    Team++;
                }

      case 1: {  SetPlayerTeam(playerid, 2);
                    SetPlayerColor(playerid, 0x33AA33AA);
                    Team=0;
                }
                }
        }
       
        return 1;
}
I hope that is what you want.
Reply
#3

edit - you reedited your code as i was posting. The last part still stands.


You have no if statements in here.

So whenever a player connects you do all of these.
You set player team 1, colour 0x95DFECFF then reset team 2 and colour to 0x33AA33AA.

SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid, 0x95DFECFF);
SetPlayerTeam(playerid, 2);
SetPlayerColor(playerid, 0x33AA33AA);

If you didn't notice the lack of if statements then here is your solution:

Are you a scripting beginner?
https://sampwiki.blast.hk/wiki/Main_Page
Reply
#4

Quote:
Originally Posted by Jeffry
Okay, this is untested, but try it:


At top of your GM
pawn Код:
new Team;

and this is the OnPlayerSpawn

pawn Код:
public OnPlayerSpawn(playerid)
{

        {
        switch (Team)
                {
      case 0: {  SetPlayerTeam(playerid, 1);
                    SetPlayerColor(playerid, 0x95DFECFF);
                    Team++;
                }

      case 1: {  SetPlayerTeam(playerid, 2);
                    SetPlayerColor(playerid, 0x33AA33AA);
                    Team=0;
                }
                }
        }
       
        return 1;
}
I hope that is what you want.
it worked ok ,but the problem is some of the number 1 team got the blue talk

and the the others got green and team 2 all got blue


did i reverse the colours ? lol

i use the:
AddPlayerClassEx(1
AddPlayerClassEx(2
is it right to use this ?
Reply
#5

I dont know that. Sorry.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)