What should I do about these warnings?
#1

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.
Reply
#2

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.
Reply
#3

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); 
Reply
#4

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

add stock before the var to mute the warnings.
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)