View Single Post
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 10-31-2011 , 19:51   Re: Simple Chat Processor
Reply With Quote #23

Also, someone may find this handy, maybe you can include it, I don't know. This is a safe chat call you can use in OnChatMessage.

Code:
stock SafePrintToChat(client, const String:format[], any:...)
{
	new String:newString[256];
	new Handle:pack;
	
	VFormat(newString, sizeof(newString), format, 3);
	
	CreateDataTimer(0.001, Timer_SafePrintToChat, pack, TIMER_FLAG_NO_MAPCHANGE);
	WritePackCell(pack, client);
	WritePackString(pack, newString);
}

public Action:Timer_SafePrintToChat(Handle:timer, any:pack)
{
	ResetPack(pack);
	new client = ReadPackCell(pack);
	new String:text[256];
	ReadPackString(pack, text, sizeof(text));

	PrintToChat(client, text);
	
	return Plugin_Stop;
}
Thraka is offline