TEAMRADIO - 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)
+--- Thread: TEAMRADIO (
/showthread.php?tid=457883)
TEAMRADIO -
cray1100 - 13.08.2013
Ok, i wanna TEAM RADIO! I have gotten this far, correct me if im wrong, but i think i have a good start! How do i finish this?
COMMANDS
pawn Код:
CMD:sr(playerid, cmdtext[])
{
string[256];
format(string, sizeof string, "[SITH-RADIO] %s: {FFFFFF}%s", playerid, cmdtext[]);
SendMessageToTeam(2,0xFF000000,string);
return 1;
}
CMD:jr(playerid, cmdtext[])
{
string[256];
format(string, sizeof string, "[JEDI-RADIO] %s: {FFFFFF}%s", playerid, cmdtext[]);
SendMessageToTeam(1,0xFF000000,string);
return 1;
}
STOCK
pawn Код:
stock SendMessageToTeam(team,color,mess[])
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == team)
{
SendClientMessage(i,color,mess);
}
}
}
return 1;
}
Re: TEAMRADIO -
Vanter - 13.08.2013
wrong..
pawn Код:
forward SendTeam1Message(color, string[]);
public SendTeam1Message(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == TEAM1)
{
SendClientMessage(i, COLOR_BLUE, string);
}
}
}
}
//Under the command
new pname[MAX_PLAYER_NAME];
new string[126];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"[TEAM1] %s(%d): %s",pname,playerid,params);
SendTeam1Message(COLOR_BLUE,string);
Re: TEAMRADIO -
cray1100 - 13.08.2013
I had to tweak it a little, it didnt work... But after that, i combined them into this, and set it to my servers teams!
pawn Код:
CMD:r(playerid, params[])
{
if(GetPlayerTeam(playerid) == 2)
{
new pname[MAX_PLAYER_NAME];
new string[126];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"[Sith-Radio] %s(%d): %s",pname,playerid,params);
SendTeam2Message(0xFF0000FF,string);
}
else if(GetPlayerTeam(playerid) == 1)
{
new pname[MAX_PLAYER_NAME];
new string[126];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"[Jedi-Radio] %s(%d): %s",pname,playerid,params);
SendTeam1Message(0xFF0000FF,string);
}
return 1;
}
pawn Код:
forward SendTeam1Message(color, string[]);
public SendTeam1Message(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerTeam(i) == 1)
{
SendClientMessage(i, 0x0000FFFF, string);
}
}
}
}
forward SendTeam2Message(color, string[]);
public SendTeam2Message(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerTeam(i) == 2)
{
SendClientMessage(i, 0xFF0000FF, string);
}
}
}
}