SA-MP Forums Archive
What should I do about these warnings? - 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: What should I do about these warnings? (/showthread.php?tid=652937)



What should I do about these warnings? - AmarPlayer - 22.04.2018

Here's my code:
PHP код:
new File:ftw=fopen("server/komande.txt", io_append), string[100], name[MAX_PLAYER_NAME], Year, Month, Day, Datum, Hour, Minute, Second, Vrijeme;
Datum = getdate(Year, Month, Day);
Vrijeme = gettime(Hour, Minute, Second);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s: %s | %d/%d/%d | %dh:%dm:%ds\r\n", name, cmdtext, Day, Month, Year, Hour, Minute, Second);
fwrite(ftw, string);
fclose(ftw); 
When I compile it it all works correctly and as I wanted it to, but I get these warnings:
warning 204: symbol is assigned a value that is never used: "Vrijeme"
warning 204: symbol is assigned a value that is never used: "Datum"

I know why I get them and what they mean, and I know that I can just type in like "printf("%d %d", Datum, Vrijeme);" but I want to know what can I change in my code so that i don't have to do it that way.
Any help is appreciated.


Re: What should I do about these warnings? - Zeus666 - 22.04.2018

PHP код:
new File:ftw=fopen("server/komande.txt", io_append), string[100], name[MAX_PLAYER_NAME], Year, Month, Day, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s: %s | %d/%d/%d | %dh:%dm:%ds\r\n", name, cmdtext, Day, Month, Year, Hour, Minute, Second);
fwrite(ftw, string);
fclose(ftw); 
try now.


Re: What should I do about these warnings? - jasperschellekens - 22.04.2018

Since you are not doing anything with them, just make it like this:

PHP код:
getdate(Year, Month, Day); 
gettime(Hour, Minute, Second); 
instead of
PHP код:
Datum = getdate(Year, Month, Day); 
Vrijeme = gettime(Hour, Minute, Second); 



Re: What should I do about these warnings? - Similarty - 22.04.2018

You are not doing anything with that variables, just remove them before the "gettime" and "getdate".


Re: What should I do about these warnings? - std - 22.04.2018

add stock before the var to mute the warnings.


Re: What should I do about these warnings? - AmarPlayer - 22.04.2018

I feel so stupid now because I tried it the way i pasted up there and I tried it without the gettime() and getdate() function completely and it would put just zeros in the txt file, I just couldn't think of trying without the "Datum" and "Vrijeme" in front...anyways, thank you, after all that's what this section is for, right hahahaha