Raised This Month: $32 Target: $400
 8% 

Solved Line break isn't working in convar.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Visual77
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.

Code:
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode