26.08.2014, 19:57
Does anyone got idea how do i make teamchat?
Teams: Grove ballas homlesses chinese aztecas vagos police
Teams: Grove ballas homlesses chinese aztecas vagos police
CMD:t(playerid, params[])
{
if (insull(params)) return SendClientMessage(playerid, -1, "Usage: /t [message]");
new string[145], pName[24];
GetPlayerName(playerid, pName, sizeof (pName));
format(string, sizeof (string), "[TEAM CHAT] %s (%i): %s", pName, playerid, params);
foreach (new i : Player) // Change to for(new i; i != MAX_PLAYERS; i++) if you don't have foreach
{
if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
{
SendClientMessage(i, GetTeamColor(GetPlayerTeam(playerid)), string);
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if (text[0] == '#') // Change # to your symbol
{
new string[145], pName[24];
GetPlayerName(playerid, pName, sizeof (pName));
format(string, sizeof (string), "[TEAM CHAT] %s (%i): %s", pName, playerid, text[1]);
foreach (new i : Player) // Change to for(new i; i != MAX_PLAYERS; i++) if you don't have foreach
{
if (GetPlayerTeam(i) == GetPlayerTeam(playerid))
{
SendClientMessage(i, GetTeamColor(GetPlayerTeam(playerid)), string);
}
}
return 0;
}
return 1;
}
GetTeamColor(teamid)
{
switch(teamid)
{
case TEAM1: return TEAM1_COLOR;
case TEAM2: return TEAM2_COLOR;
case TEAM3: return TEAM3_COLOR;
// ...
}
return 0;
}