SA-MP Forums Archive
Sending Messages[Sovled] - 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: Sending Messages[Sovled] (/showthread.php?tid=141660)



Sending Messages[Sovled] - Steven82 - 14.04.2010

How do i send a messege from like,


TEAM_CIV,TEAM_POLICE?


Kinda like a 911 call.


Re: Sending Messages - Thrarod - 14.04.2010

Код:
for(new a=0; a<MAX_PLAYERS; a++)
{
if(GetPlayerTeam(a) == TEAM_POLICE)
{
SendClientMessage(a,COLOR_BLUE,"Radio: Suspect down, Over.")
}
}



Re: Sending Messages - Steven82 - 14.04.2010

I really don't understand that sorry, for some reason today i can't understand/remember shit??


Re: Sending Messages - Thrarod - 14.04.2010

I hope only today

Код:
if(strcmp(cmd, "/sudown", true) == 0) {
if GetPlayerTeam(playerid, TEAM_POLICE) {
for(new a=0; a<MAX_PLAYERS; a++)
{
if(GetPlayerTeam(a) == TEAM_POLICE)
{
SendClientMessage(a,COLOR_BLUE,"Radio: Suspect down, Over.") // Define color if u dont have
}
}
}else{
SendClientMessage(a,COLOR_RED,"You are not a cop") // Define color if u dont have
return 1;
}
That should work


Re: Sending Messages - woot - 14.04.2010

Or simply create a function.
pawn Код:
stock SendMessageToTeam(    team,   color,  message[]   )
{
    for(new cC; cC < MAX_PLAYERS; cC++)
    {
        if(!IsPlayerConnected(cC)) continue;
        if(GetPlayerTeam(cC) != team) continue;
        SendClientMessage(cC, color, message);
    }
}

// Example usage:
SendMessageToTeam( TEAM_COPS,  COLOR_BLUE,   "Oh my bawls, emergency!");



Re: Sending Messages - Thrarod - 14.04.2010

Yeah this is OK too!


Re: Sending Messages - Steven82 - 14.04.2010

Nvm