SA-MP Forums Archive
Help please - 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: Help please (/showthread.php?tid=615457)



Help please - MempishDevelerux - 22.08.2016

PHP код:
mysql_escape_string(inputtextPlayer[playerid][name]);
if(
len 16) {
    new 
plus[8] = "...";
    
strcat(inputtextplus);
}
PlayerTextDrawSetString(playeridLTextdraw[16][playerid], inputtext); 
And warning:
PHP код:
warning 224indeterminate array size in "sizeof" expression (symbol "maxlength"
Whats wrong ?


Re: Help please - Stinged - 22.08.2016

https://sampwiki.blast.hk/wiki/Strcat

Quote:

maxlength=sizeof dest

You can't use sizeof (inputtext).


Re: Help please - MempishDevelerux - 22.08.2016

PHP код:
strcat(inputtextplussizeof(inputtext)); 
PHP код:
warning 224indeterminate array size in "sizeof" expression (symbol ""



Re: Help please - Konstantinos - 22.08.2016

Stinged told you that you can't use sizeof with inputtext or an array without a size in general. Make another string and copy the text stored:
pawn Код:
#if !defined strcpy
    #define strcpy(%0,%1) strcat((%0[0] = EOS, %0), %1)
#endif
pawn Код:
static input_text[129];
strcpy(input_text, inputtext);
and then you can use strcat and join any text you want to "input_text" string. I'm not really sure if you meant to add 3 dots or it was just an example but if the text you are trying to "join" is constant, then you don't need to declare a string just for that.
pawn Код:
strcat(input_text, "...");
After done all that, use "input_text" in PlayerTextDrawSetString function.