#1

I've been experiencing this problem.. I have absolutely no idea why this happens.
Whenever I do so, I get lots of errors

These are the errors:
pawn Код:
..\Stocks\Functions;Stocks;.pwn(241) : error 012: invalid function call, not a valid address
..\Stocks\Functions;Stocks;.pwn(241) : warning 215: expression has no effect
..\Stocks\Functions;Stocks;.pwn(241) : warning 215: expression has no effect
..\Stocks\Functions;Stocks;.pwn(241) : warning 215: expression has no effect
..\Stocks\Functions;Stocks;.pwn(241) : warning 215: expression has no effect
..\Stocks\Functions;Stocks;.pwn(241) : warning 215: expression has no effect
..\Stocks\Functions;Stocks;.pwn(241) : error 001: expected token: ";", but found ")"
..\Stocks\Functions;Stocks;.pwn(241) : error 029: invalid expression, assumed zero
..\Stocks\Functions;Stocks;.pwn(241) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
And this is the code:
pawn Код:
stock SaveAdminAction(playerid, format[], va_args<>)
{
    new
        out[256],
        out2[256],
        File:Log = fopen(AActionsLog, io_append)
    ;
    va_format(out, sizeof(out), format, va_start<2>);
/*241*/format(out2, sizeof(out2), "Date: %s Player: %s ID: %d Level: %d Action: %s", GetDate(), GetName(playerid), playerid, GetPlayerLevel(playerid), out);
    if(Log)
    {
        fwrite(File:Log, out2);
        fclose(File:Log);
    }
}
And when I comment this line:
pawn Код:
format(out2, sizeof(out2), "Date: %s Player: %s ID: %d Level: %d Action: %s", GetDate(), GetName(playerid), playerid, GetPlayerLevel(playerid), out);
COMPILES FINE!

I know how to format a string, but this is bizzare!
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
That usually happens when you try to call a variable as a function (did you do "X(Y)" instead of "X[Y]").

I can't see it as being anything to do with y_va given that it's not on the same line.
Then how come when I do so:
pawn Код:
stock SaveAdminAction(playerid, format[], va_args<>)
{
    new
        out[256],
        out2[256],
        File:Log = fopen(AActionsLog, io_append)
    ;
    va_format(out, sizeof(out), format, va_start<2>);
    format(out2, sizeof(out2), " ", 0);
    if(Log)
    {
        fwrite(File:Log, out2);
        fclose(File:Log);
    }
}
The results are exactly the same?..

Is it just me or va_format wants to fight format ? xD
Reply
#3

Maybe GetName(playerid) suppost to be a GetName[playerid], dunno if you got it as a function or variable but check.

@UP: Was posting when ur post wasn't there :P
Reply
#4

Quote:
Originally Posted by i514x_
Посмотреть сообщение
Maybe GetName(playerid) suppost to be a GetName[playerid], dunno if you got it as a function or variable but check.

@UP: Was posting when ur post wasn't there :P
I'm not that dumb But thanks for helping.

Now when I do so:
pawn Код:
stock SaveAdminAction(playerid, format[], va_args<>)
{
    new
        out[256],
        File:Log = fopen(AActionsLog, io_append)
    ;
    va_format(out, sizeof(out), format, va_start<2>);
    if(Log)
    {
        fwrite(File:Log, TempFunc(playerid, out));
        fclose(File:Log);
    }
}
stock TempFunc(playerid, action[])
{
    new Str[256];
    format(Str, 256, "Date: %s Player: %s ID: %d Level: %d Action: %s", GetDate(), GetName(playerid), playerid, GetPlayerLevel(playerid), action);
    return Str;
}
It compiles completely fine! !
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
No idea, my only guess is that somehow using a function and local both called "format" is the problem, but I'm not sure how that could be.
Well you know better than me, oh well, I'll stick with this method(TempFunc), I only need it in this function anyway
If you can find the problem anyhow please tell me. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)