View Single Post
alongub
Veteran Member
Join Date: Aug 2009
Location: Israel
Old 02-13-2012 , 15:52   Re: The RTLer - Chat support for Hebrew and Arabic
Reply With Quote #2

Developers' API

Code:
/**
 * Converts a string that contains words in RTL languages to be displayed correctly in-game.
 *
 * @param dest 			Destination string buffer to copy the RTL-ed string to.
 * @param destLen		Destination buffer length (includes null terminator).
 * @param original		Original non-rtled string. 
 *
 * @return The amount of words that needed RTLifying.
 */
native RTLify(String:dest[], destLen, const String:original[]);
Example plugin:

Code:
#pragma semicolon 1

#include <sourcemod>
#include <rtler>

public OnPluginStart()
{
	AddCommandListener(OnRTLifyCommand, "rtlify");
}

public Action:OnRTLifyCommand(client, const String:command[], argc)
{
	new String:arg[192];
	GetCmdArgString(arg, sizeof(arg));

	new len = strlen(arg);

	decl String:dest[len];
	RTLify(dest, len, arg);

	PrintToChat(client, dest);
	return Plugin_Handled;
}

Last edited by alongub; 02-17-2012 at 16:08.
alongub is offline