SendTeamMessage - 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: SendTeamMessage (
/showthread.php?tid=163899)
SendTeamMessage -
DragonBlaster50 - 29.07.2010
Does someone have this for me? and it should work with GetPlayerTeam Instead of Gteam, Thanks!
Re: SendTeamMessage -
ViruZZzZ_ChiLLL - 29.07.2010
Dunno if this will work but, it won't hurt to try rite :
pawn Код:
stock SendTeam1Message(playerid, color, string[])
{
if(GetPlayerTeam(playerid) == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
{
SendClientMessage(i, Color, string);
}
}
}
return 0;
}
Re: SendTeamMessage -
DragonBlaster50 - 29.07.2010
Could you also tell me how i can use this? SOrry but i think there is more than just SendTeamMessage...
Re: SendTeamMessage -
Vince - 29.07.2010
Better version, you can specify the team in this, as well as the color:
pawn Код:
forward SendTeamMessage(teamid, color, const message[]);
public SendTeamMessage(teamid, color, const message[])
{
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(GetPlayerTeam(i) != teamid) continue;
SendClientMessage(i, color, message);
}
return 1;
}
Just use it like a normal SendClientMessage, but replace 'playerid', with the teamid the message has to be sent to.
Re: SendTeamMessage -
DragonBlaster50 - 29.07.2010
this wont work actually.. Its ment for a team radio, so people can talk in there themselves.. if i can use this for that aswell, please tell me how to do so.
Re: SendTeamMessage -
Vince - 29.07.2010
Like so?
pawn Код:
format(string, sizeof(string), "* Radio: %s: %s", playername, message);
SendTeamMessage(GetPlayerTeam(playerid), COLOR_WHATEVER, string);
Re: SendTeamMessage -
DragonBlaster50 - 29.07.2010
YES, thank you!
Re: SendTeamMessage -
DragonBlaster50 - 29.07.2010
I tried to fix it, its now this:
Stock:
Код:
stock SendPoliceMessage(COLOR, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
return 0;
}
And the Command itself:
Код:
if((strcmp(cmd, "/r", true) == 0) || (strcmp(cmd, "/radio", true) == 0))
{
if(GetPlayerTeam(playerid) == 1)
{
format(string, sizeof(string), "* Radio: %s: %s", pName, string);
SendPoliceMessage(COLOR_LIGHTBLUE, string);
}
return 1;
}
ERROR:
Quote:
C:\Documents and Settings\Wouter\Bureaublad\SA-MP Scripting\pawno\PoliceFaction.pwn(293) : warning 203: symbol is never used: "COLOR"
|
Re: SendTeamMessage -
DragonBlaster50 - 29.07.2010
come on, im pretty much screwed untill this is fixed..
Re: SendTeamMessage -
jonrb - 29.07.2010
Quote:
Originally Posted by DragonBlaster50
I tried to fix it, its now this:
Stock:
Код:
stock SendPoliceMessage(COLOR, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
return 0;
}
And the Command itself:
|
Try changing it to this:
Код:
stock SendPoliceMessage(string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
return 0;
}