Warnings help - 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: Warnings help (
/showthread.php?tid=492492)
Warnings help -
San1 - 04.02.2014
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
Re: Warnings help -
Voxel - 04.02.2014
You dont need to define it 2 times, remove it from the stock. I dont see any other solution.
Re: Warnings help -
Beckett - 04.02.2014
Код:
new
sz_logEntry[180],
File: logfile, // THIS Is being defined twice (globally and local)
i_dateTime[2][3];