SA-MP Forums Archive
Need help with team message! - 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: Need help with team message! (/showthread.php?tid=20533)



Need help with team message! - kevin433 - 28.12.2007

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!


Re: Need help with team message! - Lewwy - 28.12.2007

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


Re: Need help with team message! - Larry - 28.12.2007

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.


Re: Need help with team message! - Lewwy - 28.12.2007

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.



Re: Need help with team message! - Grove - 28.12.2007

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   
  }

}



Re: Need help with team message! - kevin433 - 28.12.2007

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.


Re: Need help with team message! - Grove - 28.12.2007

Well show me the lines with the errors on


Re: Need help with team message! - cmg4life - 28.12.2007

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;
}


Re: Need help with team message! - Lewwy - 28.12.2007

No thats wrong

Because that will only send to the player that died.



Re: Need help with team message! - kevin433 - 28.12.2007

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: }