View Single Post
Author Message
Veteran Member
Join Date: Jan 2009
Old 02-10-2018 , 12:41   Line break isn't working in convar.
Reply With Quote #1

I was certain I had asked this before but I couldn't find it from search.

How do you read a (line break) \n in a convar?

The line break is not treated as a line break when the message is printed to the client.

Server.cfg -> convar_message "Hi. \nThis is my line break."

ConVar hintMsg;

public void OnPluginStart()
	hintMsg = CreateConVar("convar_message", "", "Hint message");

void PrintMessage(int client)
	char buffer[256];
        hintMsg.GetString(buffer, sizeof(buffer));
	if (!strlen(buffer)) return;
	PrintHintText(client, buffer);

Last edited by Visual77; 02-10-2018 at 13:22.
Visual77 is offline