Splitting string issue - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Splitting string issue (
/showthread.php?tid=611395)
Splitting string issue -
Jonesy96 - 05.07.2016
Hi all,
I'm scripting to make OnPlayerText go onto 2 lines. My code is below:
Code:
new str1[144], str2[144], max_str = 110;
strmid(str1, text, 0, max_str);
strmid(str2, text, max_str, strlen(text));
format(str1, sizeof(str1), "{%s}%s: {%s}%s...",EMBED_WHITE, fullName(playerid, false), EMBED_WHITESMOKE, text);
format(str2, sizeof(str2), "{%s}%s: {%s}...%s",EMBED_WHITE, fullName(playerid, false), EMBED_WHITESMOKE, text);
ProxDetector(15.0, playerid, str1);
ProxDetector(15.0, playerid, str2);
However, rather than str2 dipsplaying the second half of the message, it just redisplays the first part of the message. E.g.:
Code:
[22:22:07] {FFFFFF}Joe Bloggs: {F5F5FF}I am simply testing this script. It's supposed to put things on 2 lines. However, whether that actually happens
[22:22:07] {FFFFFF}Joe Bloggs: {F5F5FF}...I am simply testing this script. It's supposed to put things on 2 lines. However, whether that actually happe
Can anyone see my error?
Thanks
Re: Splitting string issue -
Jefff - 05.07.2016
pawn Code:
fullName(playerid, false), EMBED_WHITESMOKE, text);
double time
+
you can modify
https://sampforum.blast.hk/showthread.php?tid=606021&page=3
Re: Splitting string issue -
Gammix - 05.07.2016
You are re-writing on the spited string variables which causes this.
Corrected code:
pawn Code:
format(str1, sizeof(str1), "{%s}%s: {%s}%s...",EMBED_WHITE, fullName(playerid, false), EMBED_WHITESMOKE, str1);
format(str2, sizeof(str2), "{%s}%s: {%s}...%s",EMBED_WHITE, fullName(playerid, false), EMBED_WHITESMOKE, str2);
Re: Splitting string issue -
Jonesy96 - 05.07.2016
Yeah thanks guys, noticed my mistake earlier, should have rplied. Thanks for the help, repped