enum pInfo
{
pTeam
}
stock SendTeamMessage(teamid, message[]) // This is a stock function, it pretty much allows you to use "SendTeamMessage(teamid, message[])"
{
for(new i = 0; i < MAX_PLAYERS; i++) // This is a loop it loops through the total players that your server would allow.
{
if(IsPlayerConnected(i) && PlayerInfo[i][pTeam] == teamid) // This checks if the player is connected and if there team matches the teamid.
{
SendClientMessage(i, 0xFFFFFFFF, message); // This will send the message to the team.
}
}
return 1;
}
I dont understand coding like that either,with the brackets in the same line,may you explain what all of this does please? and change code,I do not care about space in script at the moment,I am still learning.SetPlayerTeamFromClass(playerid,classid)
{
switch(classid)
{
case 0: // classid 0
{
gTeam[playerid] = 0; // it sets the data of the player who selected the first team (in the gTeam array) to TEAM_BLUE
{
SetSpawnInfo(playerid,0,176,2156.3208,-1708.1588,15.0859,89.9102,34,80,0,0,0,0);
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerInterior(playerid,0);
SetCameraBehindPlayer(playerid);
}
}
case 1: // classid 1
{
gTeam[playerid] = 1; // it sets the data of the player who selected the second team (in the gTeam array) to TEAM_RED
{
SetSpawnInfo(playerid,1,19,2528.0120,-1650.0964,14.4368,89.9102,34,80,0,0,0,0);
SetPlayerColor(playerid, COLOR_RED);
SetPlayerInterior(playerid,0);
SetCameraBehindPlayer(playerid);
}
}
}
}
stock SendTeamMessage(teamid, message[]) // SendTeamMessage(1, string);
{
for(new i = 0; i < MAX_PLAYERS; i++) // Loops through all the players.
{
if(IsPlayerConnected(i) && PlayerInfo[i][pTeam] == teamid)// If the player is connected and their 'pTeam' equals teamid then..
{
SendClientMessage(i, 0xFFFFFFFF, message); // Send the message
}
}
return 1;
}
stock SendTeamMessage(teamid, message[]) // This is a stock function, it pretty much allows you to use "SendTeamMessage(teamid, message[])"
{
for(new i = 0; i < MAX_PLAYERS; i++) // This is a loop it loops through the total players that your server would allow.
{
if(IsPlayerConnected(i) && gTeam[i] == teamid) // This checks if the player is connected and if there team matches the teamid.
{
SendClientMessage(i, 0xFFFFFFFF, message); // This will send the message to the team.
}
}
return 1;
}
|
Here you go.
pawn Код:
|
stock SendTeamMessage(teamid, message[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == TEAM_BLUE)
{
SendClientMessage(i, TEAM_BLUE_COLOR, "Blue Team Chat"message);
}
else if(IsPlayerConnected(i) && gTeam[i] == TEAM_RED)
{
SendClientMessage(i, TEAM_RED_COLOR,"Red Team Chat"message);
}
}
return 1;
}