AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [USEFUL STOCK] ChatMessage (https://forums.alliedmods.net/showthread.php?t=56033)

sumguy14 06-05-2007 00:20

[USEFUL STOCK] ChatMessage
 
This is basically just PrintToChat but you can give it 0 as a client index which messages to all players. I am new to SourceMod so go easy, it may not be the best quality.

Example:

Code:

ChatMessage(0,"This is a message to the whole server");
Code:

Code:

stock ChatMessage(target,const String:message[],any:...)
{
  decl String:buffer[192];
  VFormat(buffer,191,message,3);
  if(target)
    PrintToChat(target,"%s",buffer);
  else
  {
    new maxplayers=GetMaxClients()
    for(new index=1;index<=maxplayers;index++)
    {
      if(IsClientConnected(index))
        PrintToChat(index,"%s",buffer);
    }
  }
}



All times are GMT -4. The time now is 09:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.