Raised This Month: $ Target: $400
 0% 

Read certain part of chat message


Post New Thread Reply   
 
Thread Tools Display Modes
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-29-2014 , 20:35   Re: Read certain part of chat message
Reply With Quote #11

Nope. You cannot use sizeof when working with strings. You need to have room for the null character in the last cell. Otherwise this will happen:
Code:
new string[1], string2[1]; string[0] = 'X'; string2[0] = 'Y'; server_print("%s, %s", string, string2);

Code:
X, YX
It's gonna break after 31 characters, which is the max length of a player name.
sizeof Name = 32
charsmax(Name) = 31

No the command is not 32 cells big, I only used that because it was easy.
You need room for "/report" which is 7. Then you need 1 to make sure that it's not /reportx or whatever. And lastly 1 for the null. So Command[9] is fine.
__________________

Last edited by Black Rose; 03-29-2014 at 20:45.
Black Rose is offline
Reply



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 17:54.


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