SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/10/2018, 08:20 PM   #11
SapMan
Big Clucker
 
Join Date: Jul 2017
Posts: 112
Reputation: 12
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")

I have not modified it "OnPlayerText (playerid, text [])" so it is in my game mode. When I use "TestText (text);" in the callback "OnPlayerText", I throw away the error that I previously published.
SapMan is offline   Reply With Quote
Old 14/10/2018, 08:28 PM   #12
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,211
Reputation: 3180
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")

You do modify it - that's what is happening in `strreplace`.
Y_Less is online now   Reply With Quote
Old 14/10/2018, 10:05 PM   #13
SapMan
Big Clucker
 
Join Date: Jul 2017
Posts: 112
Reputation: 12
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")

Well, then how should it be exactly?
SapMan is offline   Reply With Quote
Old 14/10/2018, 11:04 PM   #14
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 2,656
Reputation: 322
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")

pawn Code:
public OnPlayerText(playerid, text[])
{
    TestText(text,strlen(text));
    return 0;
}

CMD:test(playerid, params[])
{
    new text[90];
    if(sscanf(params, "s[90]", text)) return SendClientMessage(playerid,-1, "/test (text)");
   
    TestText(text); // text is 90 so you dont need pass sizeof
    new str[90]; format(str, sizeof(str), "%s", text);
    SendClientMessageToAll(-1, str);
    return 1;
}

TestText(text[], s_size = sizeof(text))
{
    strreplace(text, "test_01", "replace_01", .maxlength = s_size);
    strreplace(text, "test_02", "replace_02", .maxlength = s_size);
    return 1;
}
Jefff is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command warning (params) warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength") Riwerry Scripting Help 1 24/05/2014 11:54 PM
warning 224: indeterminate array size in "sizeof" expression (symbol "") Fierro Scripting Help 7 12/10/2013 03:59 PM
"Must be a constant expression; assumed zero","Array dimensions do not match" Fierro Scripting Help 0 08/09/2013 11:11 PM
5 Dialog errors - Input line too long, undefined symbol "t","is" and "only" Deal-or-die Scripting Help 6 01/05/2012 01:08 PM
[SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "") LarzI Help Archive 2 22/12/2009 05:32 AM


All times are GMT. The time now is 06:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.