Warnings help
#1

Im getting these errors and idk why, The code is being used and is defined

Код:
C:\Users\Adrian\Desktop\SA-MP Scripting Files\Vitality Gaming Roleplay\gamemodes\VGRP.pwn(22642) : warning 219: local variable "logfile" shadows a variable at a preceding level
C:\Users\Adrian\Desktop\SA-MP Scripting Files\Vitality Gaming Roleplay\gamemodes\VGRP.pwn(124114) : warning 203: symbol is never used: "logfile"
pawn Код:
stock Log(sz_fileName[], sz_input[]) {

    new
        sz_logEntry[180],
        File: logfile,
        i_dateTime[2][3];

    gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
    getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);

    format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%02i:%02i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
    if(logfile) fclose(logfile);
    if(!fexist(sz_fileName)) logfile = fopen(sz_fileName, io_write);
    else logfile = fopen(sz_fileName, io_append);
    if(logfile)
    {
        fwrite(logfile, sz_logEntry);
        fclose(logfile);
    }
    return 1;
}
pawn Код:
new File:logfile; // global variable for buffer overflow protection
Example of it being used ===>
pawn Код:
Log("logs/adminpay.log", string);
PLEASE HELP i'll ++REP you
Reply
#2

You dont need to define it 2 times, remove it from the stock. I dont see any other solution.
Reply
#3

Код:
    new
        sz_logEntry[180],
        File: logfile, // THIS Is being defined twice (globally and local)
        i_dateTime[2][3];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)