PHP Code:
public sendMessage (color[], alive)
{
new teamName[10]
for (new player = 1; player < maxPlayers; player++)
{
if(!is_user_bot(player))
{
if(is_user_connected(player))
{
get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
changeTeamInfo (player, color) // Changes user's team according to color choosen
writeMessage (player, message) // Writes the message on player's chat
changeTeamInfo (player, teamName) // Changes user's team back to original
}
}
}
}
PHP Code:
public sendTeamMessage (color[], alive, playerTeam)
{
new teamName[10]
for (new player = 1; player < maxPlayers; player++)
{
if(!is_user_bot(player))
{
if (get_user_team(player) == playerTeam)
{
if(is_user_connected(player))
{
get_user_team (player, teamName, 9) // Stores user's team name to change back after sending the message
changeTeamInfo (player, color) // Changes user's team according to color choosen
writeMessage (player, message) // Writes the message on player's chat
changeTeamInfo (player, teamName) // Changes user's team back to original
}
}
}
}
}
PHP Code:
public changeTeamInfo (player, team[])
{
if(is_user_connected(player))
{
if(!is_user_bot(player))
{
message_begin (MSG_ONE, teamInfo, _, player) // Tells to to modify teamInfo (Which is responsable for which time player is)
write_byte (player) // Write byte needed
write_string (team) // Changes player's team
message_end()
}
}
}
public writeMessage (player, message[])
{
if(is_user_connected(player))
{
if(!is_user_bot(player))
{
message_begin (MSG_ONE, sayText, {0, 0, 0}, player) // Tells to modify sayText (Which is responsable for writing colored messages)
write_byte (player) // Write byte needed
write_string (message) // Effectively write the message, finally, afterall
message_end () // Needed as always
}
}
}