Need help with team message!
#1

Hi,
How can i make a message that when someone of the team: TEAM_AMERICA died, a message appears to the TEAM_AMERICA? Like: Oh no! We lost an American man! Kill the Japaneses!
Reply
#2

I struggled with this too.

gTeam is fairly easy and i understand most of it, but sending a message to one Team is pretty complicated for me. I've only been scripting 2 months.

So if anyone finds out thanks alot :P
Reply
#3

At the bottom of the script put:
Код:
SendAmericaMessage(COLOR, text[]) {
  for(new i = 0; i < MAX_PLAYERS; i ++) {
  	if(IsPlayerConnected(i)) {
	  	if (gTeam[i] == TEAM_AMERICAN) {
      	SendClientMessage(i, COLOR, text);
      }
    }
  }
}
Then
Код:
SendAmericaMessage(playerid, COLOR_RED, "[text]");
I think it's something like that, Try it.
Reply
#4

When i did it i got this error:

Код:
C:\Documents and Settings\Lewis_2\Desktop\My Sa-Mp Server\gamemodes\driftrpg.pwn(342) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

Were you want to send the message, Just add:

Код:
for(new i = 0; i < MAX_PLAYERS; i ++) 
{
  	
  if (gTeam[i] == TEAM_AMERICAN) 
  {
  // DO WHATEVER YOU WANT TO AMERICAN TEAM HERE   
  }

}
Reply
#6

thanks, but i get errors:

C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(334) : error 035: argument type mismatch (argument 2)
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(477) : error 010: invalid function or declaration
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(479) : error 010: invalid function or declaration
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(484) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Well show me the lines with the errors on
Reply
#8

i was thinkin somethin like
OnPlayerDeath(param here)
{

if ( gTeam == TEAM_AMERICA )
{
SendClientMessage( dunno here , COLOR, "msg" );
}
else if (gTeam == TEAM_JAPAN )
{
SendClientMessage
}
return 1;
}
Reply
#9

No thats wrong

Because that will only send to the player that died.
Reply
#10

The errors:
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(373) : error 035: argument type mismatch (argument 2)
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(516) : error 010: invalid function or declaration
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(51 : error 010: invalid function or declaration
C:\Users\Kevin\Desktop\san andreas server pearl harbor\gamemodes\ph.pwn(523) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

and the lines:

public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
line 373: SendAmericaMessage(playerid, COLOR_RED, "[text]");
return 1;
}

line 516:for(new i = 0; i < MAX_PLAYERS; i ++)
{
line 518: if (gTeam[i] == TEAM_AMERICA)
{
SendClientMessage(playerid,COLOR_RED, "Oh no! We lost an American man! Kill the Japaneses!");
}

line 523: }


Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)