Skip to content

Commit

Permalink
Merge pull request #25 from Y-Less/Branch_printf
Browse files Browse the repository at this point in the history
Try include console.inc
  • Loading branch information
Southclaws authored Sep 24, 2019
2 parents 6124e82 + 775cb4f commit d4a7fd5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 58 deletions.
61 changes: 32 additions & 29 deletions a_npc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public const SAMP_INCLUDES_VERSION = 0x037030;
#include <file>
#include <time>
#include <datagram>
#tryinclude <console>

/*
Expand Down Expand Up @@ -234,35 +235,37 @@ open.mp releases can use `A` as the first digit.

// Util

/// <summary>Prints a string to the server console (not in-game chat) and logs (server_log.txt).</summary>
/// <param name="string">The string to print</param>
/// <seealso name="printf"/>
native print(const string[]);

/// <summary>Outputs a formatted string on the console (the server window, not the in-game chat).</summary>
/// <param name="format">The format string</param>
/// <param name="">Indefinite number of arguments of any tag</param>
/// <seealso name="print"/>
/// <seealso name="format"/>
/// <remarks>The format string or its output should not exceed 1024 characters. Anything beyond that length can lead to a server to crash.</remarks>
/// <remarks>This function doesn't support <a href="#strpack">packed</a> strings.</remarks>
/// <remarks>
/// <b>Format Specifiers:</b><p/>
/// <ul>
/// <li><b><c>%i</c></b> - integer (whole number)</li>
/// <li><b><c>%d</c></b> - integer (whole number).</li>
/// <li><b><c>%s</c></b> - string</li>
/// <li><b><c>%f</c></b> - floating-point number (Float: tag)</li>
/// <li><b><c>%c</c></b> - ASCII character</li>
/// <li><b><c>%x</c></b> - hexadecimal number</li>
/// <li><b><c>%b</c></b> - binary number</li>
/// <li><b><c>%%</c></b> - literal <b><c>%</c></b></li>
/// <li><b><c>%q</c></b> - escape a text for SQLite. (Added in <b>0.3.7 R2</b>)</li>
/// </ul>
/// </remarks>
/// <remarks>The values for the placeholders follow in the exact same order as parameters in the call. For example, <b><c>"I am %i years old"</c></b> - the <b><c>%i</c></b> will be replaced with an Integer variable, which is the person's age.</remarks>
/// <remarks>You may optionally put a number between the <b><c>%</c></b> and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add <b><c>.&lt;max number&gt;</c></b> between the <b><c>%</c></b> and the <b><c>f</c></b>. (example: <b><c>%.2f</c></b>)</remarks>
native printf(const format[], {Float,_}:...);
#if !defined _console_included
/// <summary>Prints a string to the server console (not in-game chat) and logs (server_log.txt).</summary>
/// <param name="string">The string to print</param>
/// <seealso name="printf"/>
native print(const string[]);

/// <summary>Outputs a formatted string on the console (the server window, not the in-game chat).</summary>
/// <param name="format">The format string</param>
/// <param name="">Indefinite number of arguments of any tag</param>
/// <seealso name="print"/>
/// <seealso name="format"/>
/// <remarks>The format string or its output should not exceed 1024 characters. Anything beyond that length can lead to a server to crash.</remarks>
/// <remarks>This function doesn't support <a href="#strpack">packed</a> strings.</remarks>
/// <remarks>
/// <b>Format Specifiers:</b><p/>
/// <ul>
/// <li><b><c>%i</c></b> - integer (whole number)</li>
/// <li><b><c>%d</c></b> - integer (whole number).</li>
/// <li><b><c>%s</c></b> - string</li>
/// <li><b><c>%f</c></b> - floating-point number (Float: tag)</li>
/// <li><b><c>%c</c></b> - ASCII character</li>
/// <li><b><c>%x</c></b> - hexadecimal number</li>
/// <li><b><c>%b</c></b> - binary number</li>
/// <li><b><c>%%</c></b> - literal <b><c>%</c></b></li>
/// <li><b><c>%q</c></b> - escape a text for SQLite. (Added in <b>0.3.7 R2</b>)</li>
/// </ul>
/// </remarks>
/// <remarks>The values for the placeholders follow in the exact same order as parameters in the call. For example, <b><c>"I am %i years old"</c></b> - the <b><c>%i</c></b> will be replaced with an Integer variable, which is the person's age.</remarks>
/// <remarks>You may optionally put a number between the <b><c>%</c></b> and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add <b><c>.&lt;max number&gt;</c></b> between the <b><c>%</c></b> and the <b><c>f</c></b>. (example: <b><c>%.2f</c></b>)</remarks>
native printf(const format[], {Float,_}:...);
#endif

/// <summary>Formats a string to include variables and other strings inside it.</summary>
/// <param name="output">The string to output the result to</param>
Expand Down
61 changes: 32 additions & 29 deletions a_samp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public const SAMP_INCLUDES_VERSION = 0x037030;
#include <file>
#include <time>
#include <datagram>
#tryinclude <console>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
Expand Down Expand Up @@ -331,35 +332,37 @@ open.mp releases can use `A` as the first digit.

// Util

/// <summary>Prints a string to the server console (not in-game chat) and logs (server_log.txt).</summary>
/// <param name="string">The string to print</param>
/// <seealso name="printf"/>
native print(const string[]);

/// <summary>Outputs a formatted string on the console (the server window, not the in-game chat).</summary>
/// <param name="format">The format string</param>
/// <param name="">Indefinite number of arguments of any tag</param>
/// <seealso name="print"/>
/// <seealso name="format"/>
/// <remarks>The format string or its output should not exceed 1024 characters. Anything beyond that length can lead to a server to crash.</remarks>
/// <remarks>This function doesn't support <a href="#strpack">packed</a> strings.</remarks>
/// <remarks>
/// <b>Format Specifiers:</b><p/>
/// <ul>
/// <li><b><c>%i</c></b> - integer (whole number)</li>
/// <li><b><c>%d</c></b> - integer (whole number).</li>
/// <li><b><c>%s</c></b> - string</li>
/// <li><b><c>%f</c></b> - floating-point number (Float: tag)</li>
/// <li><b><c>%c</c></b> - ASCII character</li>
/// <li><b><c>%x</c></b> - hexadecimal number</li>
/// <li><b><c>%b</c></b> - binary number</li>
/// <li><b><c>%%</c></b> - literal <b><c>%</c></b></li>
/// <li><b><c>%q</c></b> - escape a text for SQLite. (Added in <b>0.3.7 R2</b>)</li>
/// </ul>
/// </remarks>
/// <remarks>The values for the placeholders follow in the exact same order as parameters in the call. For example, <b><c>"I am %i years old"</c></b> - the <b><c>%i</c></b> will be replaced with an Integer variable, which is the person's age.</remarks>
/// <remarks>You may optionally put a number between the <b><c>%</c></b> and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add <b><c>.&lt;max number&gt;</c></b> between the <b><c>%</c></b> and the <b><c>f</c></b>. (example: <b><c>%.2f</c></b>)</remarks>
native printf(const format[], {Float,_}:...);
#if !defined _console_included
/// <summary>Prints a string to the server console (not in-game chat) and logs (server_log.txt).</summary>
/// <param name="string">The string to print</param>
/// <seealso name="printf"/>
native print(const string[]);

/// <summary>Outputs a formatted string on the console (the server window, not the in-game chat).</summary>
/// <param name="format">The format string</param>
/// <param name="">Indefinite number of arguments of any tag</param>
/// <seealso name="print"/>
/// <seealso name="format"/>
/// <remarks>The format string or its output should not exceed 1024 characters. Anything beyond that length can lead to a server to crash.</remarks>
/// <remarks>This function doesn't support <a href="#strpack">packed</a> strings.</remarks>
/// <remarks>
/// <b>Format Specifiers:</b><p/>
/// <ul>
/// <li><b><c>%i</c></b> - integer (whole number)</li>
/// <li><b><c>%d</c></b> - integer (whole number).</li>
/// <li><b><c>%s</c></b> - string</li>
/// <li><b><c>%f</c></b> - floating-point number (Float: tag)</li>
/// <li><b><c>%c</c></b> - ASCII character</li>
/// <li><b><c>%x</c></b> - hexadecimal number</li>
/// <li><b><c>%b</c></b> - binary number</li>
/// <li><b><c>%%</c></b> - literal <b><c>%</c></b></li>
/// <li><b><c>%q</c></b> - escape a text for SQLite. (Added in <b>0.3.7 R2</b>)</li>
/// </ul>
/// </remarks>
/// <remarks>The values for the placeholders follow in the exact same order as parameters in the call. For example, <b><c>"I am %i years old"</c></b> - the <b><c>%i</c></b> will be replaced with an Integer variable, which is the person's age.</remarks>
/// <remarks>You may optionally put a number between the <b><c>%</c></b> and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add <b><c>.&lt;max number&gt;</c></b> between the <b><c>%</c></b> and the <b><c>f</c></b>. (example: <b><c>%.2f</c></b>)</remarks>
native printf(const format[], {Float,_}:...);
#endif

/// <summary>Formats a string to include variables and other strings inside it.</summary>
/// <param name="output">The string to output the result to</param>
Expand Down

0 comments on commit d4a7fd5

Please sign in to comment.