Get rid of annoying warnings
#1

Hi, in my script I'm using SetTimer, to call a function, this is the only time I use the function, and pawno doesn't recognise the function as being used, therefore I get annoying warnings such as

Код:
warning 203: symbol is never used: "FinalStageGarbageFinish"
I was wondering, is there anyway to trick pawno into thinking I'm using it? The warnings are damn right annoying!
Reply
#2

Probably because it isn't being used. You've maybe set something and forgot to assign something to that name?
Reply
#3

It doesn't matter whether or not it is called only by the timer.

A timer calls a callback. FinalStageGarbageFinish appears to be a simple variable that is assigned a value then never used.
Reply
#4

You should really delete the variable if it's not going to be used. If it is going to be used further down the line and you want to hide the warning use this.

pawn Код:
#pragma unused FinalStageGarbageFinish
EDIT: Didn't realise it was a func you was talking about, make it a stock function. (you can also make variables stock)

pawn Код:
stock foo( bar[] )
{
}
Reply
#5

Okay, the timer was my fault, but I also get this:

Код:
warning 204: symbol is assigned a value that is never used: "RouteText"
But, I do use it, see here:
(snippets taken from script)
pawn Код:
new RouteText[255]; // declaring the variable
    format(RouteText, sizeof(RouteText), TXT_GarbagePickupsLeft, TotalToPickup); // assigning a value
    TextDrawSetString(APlayerData[playerid][MissionText], RouteText); // using the variable
Anyone got an idea why its doing that? Have I done something wrong? (The script still works)
Reply
#6

Quote:
Originally Posted by Stevee
Посмотреть сообщение
Okay, the timer was my fault, but I also get this:

Код:
warning 204: symbol is assigned a value that is never used: "RouteText"
But, I do use it, see here:
(snippets taken from script)
pawn Код:
new RouteText[255]; // declaring the variable
    format(RouteText, sizeof(RouteText), TXT_GarbagePickupsLeft, TotalToPickup); // assigning a value
    TextDrawSetString(APlayerData[playerid][MissionText], RouteText); // using the variable
Anyone got an idea why its doing that? Have I done something wrong? (The script still works)
Try this or go less on the [128]
pawn Код:
new RouteText[128]; // declaring the variable
    format(RouteText, sizeof(RouteText), TXT_GarbagePickupsLeft, TotalToPickup); // assigning a value
    TextDrawSetString(APlayerData[playerid][MissionText], RouteText); // using the variable
Reply
#7

Nope, I even went down to the exact amount of characters there were in that message, had no effect on the warning
Reply
#8

Quote:
Originally Posted by Stevee
Посмотреть сообщение
Nope, I even went down to the exact amount of characters there were in that message, had no effect on the warning
Basically what it means is your not using the RouteText. Even know you have it on the lines you showed they don't count as using it. You need to include it with a command or a dialog or anything else. So try including it with a command or a dialog of some type.
Reply
#9

Quote:
Originally Posted by tiernantheman
Посмотреть сообщение
Basically what it means is your not using the RouteText. Even know you have it on the lines you showed they don't count as using it. You need to include it with a command or a dialog or anything else. So try including it with a command or a dialog of some type.
It does count as using it if you use it in a function, which he has done. I'm confused because you shouldn't get the warning with the code that was posted.

This doesn't cause a warning.
pawn Код:
public OnPlayerSpawn(playerid)
{
    new used[6] = "hello";
    TextDrawSetString(Text:1, used);
    return 1;
}
Reply
#10

Really sorry for wasting your time, turns out I was looking at the wrong lines; note to self - read the warning properly.
Thankfully, all warnings have now been resolved!

I appreciate the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)