Implemented amb370 - added PrintToChatAll stock
Also added PrintCenterTextAll stock --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40898
This commit is contained in:
parent
96527c93dc
commit
bd15f93d7d
@ -290,12 +290,12 @@ static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pPlayer)
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not valid", params[1]);
|
||||
return pContext->ThrowNativeError("Client %d is not valid", client);
|
||||
}
|
||||
|
||||
if (!pPlayer->IsInGame())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not in game", params[1]);
|
||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
@ -313,12 +313,12 @@ static cell_t PrintCenterText(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (!pPlayer)
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not valid", params[1]);
|
||||
return pContext->ThrowNativeError("Client %d is not valid", client);
|
||||
}
|
||||
|
||||
if (!pPlayer->IsInGame())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client %d is not in game", params[1]);
|
||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
|
@ -209,9 +209,9 @@ native bool:IsSoundPrecached(const String:sound[]);
|
||||
native CreateDialog(client, Handle:kv, DialogType:type);
|
||||
|
||||
/**
|
||||
* Prints a message in a client's chat area.
|
||||
* Prints a message to a specific client in the chat area.
|
||||
*
|
||||
* @param client Player index.
|
||||
* @param client Client index.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @noreturn
|
||||
@ -220,12 +220,58 @@ native CreateDialog(client, Handle:kv, DialogType:type);
|
||||
native PrintToChat(client, const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Prints a message in the center of a client's screen.
|
||||
* Prints a message to all clients in the chat area.
|
||||
*
|
||||
* @param client Player index.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @noreturn
|
||||
*/
|
||||
stock PrintToChatAll(const String:format[], any:...)
|
||||
{
|
||||
new num = GetMaxClients();
|
||||
decl buffer[256];
|
||||
|
||||
VFormat(buffer, sizeof(buffer), format, 2);
|
||||
|
||||
for (new i = 1; i < num; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
PrintToChat(i, "%s", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a message to a specific client in the center of the screen.
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @noreturn
|
||||
* @error If the client is not connected an error will be thrown.
|
||||
*/
|
||||
native PrintCenterText(client, const String:format[], any:...);
|
||||
|
||||
/**
|
||||
* Prints a message to all clients in the center of the screen.
|
||||
*
|
||||
* @param format Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @noreturn
|
||||
*/
|
||||
stock PrintCenterTextAll(const String:format[], any:...)
|
||||
{
|
||||
new num = GetMaxClients();
|
||||
decl buffer[256];
|
||||
|
||||
VFormat(buffer, sizeof(buffer), format, 2);
|
||||
|
||||
for (new i = 1; i < num; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
PrintCenterText(i, "%s", buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user