Hallo Leute,
Ich hab da mal wieder ein Problem wo ich nicht ganz weiter komme..
Ich hätte es gerne das sobald ein String (SendClientMessage/ToAll) größer als 128 Zeichen ist, dieser in einer neuen Zeile fortgesetzt wird.
Beispiel:
Hallo, ich bin der Michi und hab da ein dickes Problem da mein Code den ich gemacht habe nicht gehen möchte, das ist sehr...
...sehr schade! Ich hab den Code lieb und er mich nicht!
Soll nur ein Beispiel sein damit ihr versteht wie ich das meine.
Der Code lautet so (Habe SendClientMessage und SendClientMessageToAll umdefiniert zu meinen eigenen stock's).
stock SendClientMessageToAllEx(color,string[])
{
new str1[128],str2[128];
if(strlen(string)>125)
{
format(str1,sizeof(str1),"%s...",string);
strmid(str2,string,128,256);
SendClientMessageToAll(color,str1);
SendClientMessageToAll(color,str2);
}
else{format(str1,sizeof(str1),"%s",string); SendClientMessageToAll(color,str1);}
return 1;
}
stock SendClientMessageEx(playerid,color,string[])
{
new str1[128],str2[128];
if(strlen(string)>125)
{
format(str1,sizeof(str1),"%s...",string);
strmid(str2,string,128,256);
SendClientMessage(playerid,color,str1);
SendClientMessage(playerid,color,str2);
}
else{format(str1,sizeof(str1),"%s",string); SendClientMessage(playerid,color,str1);}
return 1;
}
Aber in der Log kommt ein nettes gespame (Hab ja das crashdetect plugin) :
[16:00:11] [debug] Stack pointer (STK) is 0xB2FC8, heap pointer (HEA) is 0xB2FF8
[16:00:11] [debug] AMX backtrace:
[16:00:11] [debug] #0 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b37f8 " ") at sfrl.p:13601
[16:00:11] [debug] #1 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b3c10 " ") at sfrl.p:13601
[16:00:11] [debug] #2 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b4028 " ") at sfrl.p:13601
[16:00:11] [debug] #3 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b4440 " ") at sfrl.p:13601
[16:00:11] [debug] #4 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b4858 " ") at sfrl.p:13601
[16:00:11] [debug] #5 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b4c70 " ") at sfrl.p:13601
[16:00:11] [debug] #6 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b5088 " ") at sfrl.p:13601
[16:00:11] [debug] #7 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b54a0 " ") at sfrl.p:13601
[16:00:11] [debug] #8 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b58b8 " ") at sfrl.p:13601
[16:00:11] [debug] #9 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b5cd0 " ") at sfrl.p:13601
[16:00:11] [debug] #10 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b60e8 " ") at sfrl.p:13601
[16:00:11] [debug] #11 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b6500 " ") at sfrl.p:13601
[16:00:11] [debug] #12 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b6918 " ") at sfrl.p:13601
[16:00:11] [debug] #13 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b6d30 " ") at sfrl.p:13601
[16:00:11] [debug] #14 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b7148 " ") at sfrl.p:13601
[16:00:11] [debug] #15 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b7560 " ") at sfrl.p:13601
[16:00:11] [debug] #16 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b7978 " ") at sfrl.p:13601
[16:00:11] [debug] #17 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b7d90 " ") at sfrl.p:13601
[16:00:11] [debug] #18 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b81a8 " ") at sfrl.p:13601
[16:00:11] [debug] #19 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b85c0 " ") at sfrl.p:13601
[16:00:11] [debug] #20 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b89d8 " ") at sfrl.p:13601
[16:00:11] [debug] #21 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b8df0 " ") at sfrl.p:13601
[16:00:11] [debug] #22 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b9208 " ") at sfrl.p:13601
[16:00:11] [debug] #23 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b9620 " ") at sfrl.p:13601
[16:00:11] [debug] #24 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b9a38 " ") at sfrl.p:13601
[16:00:11] [debug] #25 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000b9e50 " ") at sfrl.p:13601
[16:00:11] [debug] #26 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ba268 " ") at sfrl.p:13601
[16:00:11] [debug] #27 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ba680 " ") at sfrl.p:13601
[16:00:11] [debug] #28 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000baa98 " ") at sfrl.p:13601
[16:00:11] [debug] #29 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000baeb0 " ") at sfrl.p:13601
[16:00:11] [debug] #30 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bb2c8 " ") at sfrl.p:13601
[16:00:11] [debug] #31 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bb6e0 " ") at sfrl.p:13601
[16:00:11] [debug] #32 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bbaf8 " ") at sfrl.p:13601
[16:00:11] [debug] #33 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bbf10 " ") at sfrl.p:13601
[16:00:11] [debug] #34 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bc328 " ") at sfrl.p:13601
[16:00:11] [debug] #35 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bc740 " ") at sfrl.p:13601
[16:00:11] [debug] #36 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bcb58 " ") at sfrl.p:13601
[16:00:11] [debug] #37 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bcf70 " ") at sfrl.p:13601
[16:00:11] [debug] #38 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bd388 " ") at sfrl.p:13601
[16:00:11] [debug] #39 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bd7a0 " ") at sfrl.p:13601
[16:00:11] [debug] #40 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bdbb8 " ") at sfrl.p:13601
[16:00:11] [debug] #41 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bdfd0 " ") at sfrl.p:13601
[16:00:11] [debug] #42 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000be3e8 " ") at sfrl.p:13601
[16:00:11] [debug] #43 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000be800 " ") at sfrl.p:13601
[16:00:11] [debug] #44 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bec18 " ") at sfrl.p:13601
[16:00:11] [debug] #45 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bf030 " ") at sfrl.p:13601
[16:00:11] [debug] #46 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bf448 " ") at sfrl.p:13601
[16:00:11] [debug] #47 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bf860 " ") at sfrl.p:13601
[16:00:11] [debug] #48 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000bfc78 " ") at sfrl.p:13601
[16:00:11] [debug] #49 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c0090 " ") at sfrl.p:13601
[16:00:11] [debug] #50 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c04a8 " ") at sfrl.p:13601
[16:00:11] [debug] #51 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c08c0 " ") at sfrl.p:13601
[16:00:11] [debug] #52 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c0cd8 " ") at sfrl.p:13601
[16:00:11] [debug] #53 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c10f0 " ") at sfrl.p:13601
[16:00:11] [debug] #54 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c1508 " ") at sfrl.p:13601
[16:00:11] [debug] #55 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c1920 " ") at sfrl.p:13601
[16:00:11] [debug] #56 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c1d38 " ") at sfrl.p:13601
[16:00:11] [debug] #57 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c2150 " ") at sfrl.p:13601
[16:00:11] [debug] #58 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c2568 " ") at sfrl.p:13601
[16:00:11] [debug] #59 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c2980 " ") at sfrl.p:13601
[16:00:11] [debug] #60 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c2d98 " ") at sfrl.p:13601
[16:00:11] [debug] #61 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c31b0 " ") at sfrl.p:13601
[16:00:11] [debug] #62 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c35c8 " ") at sfrl.p:13601
[16:00:11] [debug] #63 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c39e0 " ") at sfrl.p:13601
[16:00:11] [debug] #64 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c3df8 " ") at sfrl.p:13601
[16:00:11] [debug] #65 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c4210 " ") at sfrl.p:13601
[16:00:11] [debug] #66 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c4628 " ") at sfrl.p:13601
[16:00:11] [debug] #67 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c4a40 " ") at sfrl.p:13601
[16:00:11] [debug] #68 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c4e58 " ") at sfrl.p:13601
[16:00:11] [debug] #69 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c5270 " ") at sfrl.p:13601
[16:00:11] [debug] #70 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c5688 " ") at sfrl.p:13601
[16:00:11] [debug] #71 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c5aa0 " ") at sfrl.p:13601
[16:00:11] [debug] #72 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c5eb8 " ") at sfrl.p:13601
[16:00:11] [debug] #73 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c62d0 " ") at sfrl.p:13601
[16:00:11] [debug] #74 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c66e8 " ") at sfrl.p:13601
[16:00:11] [debug] #75 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c6b00 " ") at sfrl.p:13601
[16:00:11] [debug] #76 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c6f18 " ") at sfrl.p:13601
[16:00:11] [debug] #77 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c7330 " ") at sfrl.p:13601
[16:00:11] [debug] #78 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c7748 " ") at sfrl.p:13601
[16:00:11] [debug] #79 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c7b60 " ") at sfrl.p:13601
[16:00:11] [debug] #80 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c7f78 " ") at sfrl.p:13601
[16:00:11] [debug] #81 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c8390 " ") at sfrl.p:13601
[16:00:11] [debug] #82 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c87a8 " ") at sfrl.p:13601
[16:00:11] [debug] #83 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c8bc0 " ") at sfrl.p:13601
[16:00:11] [debug] #84 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c8fd8 " ") at sfrl.p:13601
[16:00:11] [debug] #85 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c93f0 " ") at sfrl.p:13601
[16:00:11] [debug] #86 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c9808 " ") at sfrl.p:13601
[16:00:11] [debug] #87 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000c9c20 " ") at sfrl.p:13601
[16:00:11] [debug] #88 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ca038 " ") at sfrl.p:13601
[16:00:11] [debug] #89 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ca450 " ") at sfrl.p:13601
[16:00:11] [debug] #90 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ca868 " ") at sfrl.p:13601
[16:00:11] [debug] #91 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cac80 " ") at sfrl.p:13601
[16:00:11] [debug] #92 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cb098 " ") at sfrl.p:13601
[16:00:11] [debug] #93 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cb4b0 " ") at sfrl.p:13601
[16:00:11] [debug] #94 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cb8c8 " ") at sfrl.p:13601
[16:00:11] [debug] #95 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cbce0 " ") at sfrl.p:13601
[16:00:11] [debug] #96 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cc0f8 " ") at sfrl.p:13601
[16:00:11] [debug] #97 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cc510 " ") at sfrl.p:13601
[16:00:11] [debug] #98 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000cc928 " ") at sfrl.p:13601
[16:00:11] [debug] #99 000cbed4 in SendClientMessageEx (playerid=0, color=-1, string[]=@0x000ccd40 " ") at sfrl.p:13601
[16:00:11] [debug] #100 000cbed4 in public OnPlayerConnect (playerid=0, ... <2 arguments>) at sfrl.p:13601
Hat da jemand ne Lösung? Ich hatte schon von nem anderen Thread (Codeschnipsel) 2 andere Varianten, eine hatte die selben Errors, und der andere hat den
String nicht so geteilt wie ich das wollte.
Mfg
Michi