SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 08/10/2013, 11:29 PM   #1
Fierro
Big Clucker
 
Join Date: Sep 2011
Posts: 60
Reputation: 0
Question warning 224: indeterminate array size in "sizeof" expression (symbol "")

pawn Code:
public ChangePlayerDecisions(playerid,decisions[])
{
    new fm[128];
    for(new i = 0; i < sizeof(decisions); i++)//line 523
    {
        PlayerDecisions[playerid][i] = decisions[i];
        format(fm,sizeof(fm),"/%i: %s",i+1,decisionMessages[i]);
        OnPlayerDecisionsChange(playerid,decisions);
    }
    return 1;
}

Error:
Code:
(523) warning 224: indeterminate array size in "sizeof" expression (symbol "")
Can someone please explain? I'm using sizeof with an existing symbol, so why is it blank there? Is it undetermined somehow because I didn't specify a length in the function's declaration/definition?
__________________
Fierro is offline   Reply With Quote
Old 08/10/2013, 11:32 PM   #2
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 2,653
Reputation: 322
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Try
pawn Code:
public ChangePlayerDecisions(playerid,decisions[], s_size = sizeof(decisions))
for(new i = 0; i < s_size-1; i++)//line 523
Jefff is online now   Reply With Quote
Old 08/10/2013, 11:36 PM   #3
Fierro
Big Clucker
 
Join Date: Sep 2011
Posts: 60
Reputation: 0
Thumbs up Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

EDIT: Never mind. Didn't have to be public (don't know why it was in the first place). Thanks, repping
__________________
Fierro is offline   Reply With Quote
Old 08/10/2013, 11:44 PM   #4
Fierro
Big Clucker
 
Join Date: Sep 2011
Posts: 60
Reputation: 0
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Having another problem:
pawn Code:
ChangePlayerDecisions(playerid,{DECISION_SETTINGS_CHANGE_PASS,DECISION_SETTINGS_SHOW_DEATHS,DECISION_SETTINGS_PREF_CITY,DECISION_SETTINGS_MAX_TRIES});//line 736 (duh)

Errors:
Code:
....pwn(736) : error 001: expected token: "}", but found ";"
....pwn(736) : error 001: expected token: ",", but found ";"
....pwn(736) : error 029: invalid expression, assumed zero
....pwn(736) : fatal error 107: too many error messages on one line
Edit: And yes, the DECISION_... variables are defined:
pawn Code:
#define DECISION_SETTINGS_CHANGE_PASS 0;
#define DECISION_SETTINGS_SHOW_DEATHS 1;
#define DECISION_SETTINGS_PREF_CITY 2;
#define DECISION_SETTINGS_MAX_TRIES 3;
__________________
Fierro is offline   Reply With Quote
Old 08/10/2013, 11:52 PM   #5
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,196
Reputation: 315
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Why are your parameters wrapped in { }?
__________________
Release NameUse
FairPlayKeep the cheaters out of your server
Object Model ArrayArray of every single object model in the game
RCON PanelControl any server as you like with RCON controls
SlopeClimb up a steep hill against other players with cars falling down

I do not play on any SAMP server. Anyone with the name Ricky Phelps in-game is an imposter.
SuperViper is offline   Reply With Quote
Old 09/10/2013, 12:03 AM   #6
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 2,653
Reputation: 322
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

pawn Code:
#define DECISION_SETTINGS_CHANGE_PASS   0
#define DECISION_SETTINGS_SHOW_DEATHS   1
#define DECISION_SETTINGS_PREF_CITY     2
#define DECISION_SETTINGS_MAX_TRIES     3

@ChangePlayerDecisions(playerid, ...); // its forward
@ChangePlayerDecisions(playerid, ...) // its public
{
    //new fm[128];
    new
        i = 1, // 1 because we have 'playerid' as first
        n = numargs()
    ;

    while(i < n)
    {
        PlayerDecisions[playerid][i-1] = getarg(i);
        //format(fm,sizeof(fm),"/%i: %s",i+1,decisionMessages[i]);
        OnPlayerDecisionsChange(playerid,decisions);
        i++;
    }
    return 1;
}

// Usage
@ChangePlayerDecisions(playerid,DECISION_SETTINGS_CHANGE_PASS,DECISION_SETTINGS_SHOW_DEATHS,DECISION_SETTINGS_PREF_CITY,DECISION_SETTINGS_MAX_TRIES);

and show OnPlayerDecisionsChange
Jefff is online now   Reply With Quote
Old 09/10/2013, 03:40 AM   #7
Fierro
Big Clucker
 
Join Date: Sep 2011
Posts: 60
Reputation: 0
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Quote:
Originally Posted by Jefff View Post
pawn Code:
#define DECISION_SETTINGS_CHANGE_PASS   0
#define DECISION_SETTINGS_SHOW_DEATHS   1
#define DECISION_SETTINGS_PREF_CITY     2
#define DECISION_SETTINGS_MAX_TRIES     3

@ChangePlayerDecisions(playerid, ...); // its forward
@ChangePlayerDecisions(playerid, ...) // its public
{
    //new fm[128];
    new
        i = 1, // 1 because we have 'playerid' as first
        n = numargs()
    ;

    while(i < n)
    {
        PlayerDecisions[playerid][i-1] = getarg(i);
        //format(fm,sizeof(fm),"/%i: %s",i+1,decisionMessages[i]);
        OnPlayerDecisionsChange(playerid,decisions);
        i++;
    }
    return 1;
}

// Usage
@ChangePlayerDecisions(playerid,DECISION_SETTINGS_CHANGE_PASS,DECISION_SETTINGS_SHOW_DEATHS,DECISION_SETTINGS_PREF_CITY,DECISION_SETTINGS_MAX_TRIES);

and show OnPlayerDecisionsChange
Still some errors:
Code:
heist92_01b.pwn(736) : error 001: expected token: ",", but found ";"
heist92_01b.pwn(736) : error 029: invalid expression, assumed zero
heist92_01b.pwn(736) : warning 215: expression has no effect
heist92_01b.pwn(736) : error 029: invalid expression, assumed zero
heist92_01b.pwn(736) : fatal error 107: too many error messages on one line
__________________
Fierro is offline   Reply With Quote
Old 12/10/2013, 03:59 PM   #8
Fierro
Big Clucker
 
Join Date: Sep 2011
Posts: 60
Reputation: 0
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Bump.
__________________
Fierro 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
"Must be a constant expression; assumed zero","Array dimensions do not match" Fierro Scripting Help 0 08/09/2013 11:11 PM
error: undefine symbol "j" and expected token ";" but found "]" JEkvall95 Scripting Help 9 27/07/2013 11:09 AM
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 09:29 PM.


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