Warning Fix
#1

How to fix this warn??
Code:
./FGRP.pwn(3978) : warning 203: symbol is never used: "z"
Warn from this:
Code:
stock Get2DZoneFromCoordinates(Float:x, Float:y, Float:z, zone[], len = sizeof(zone))
{
    for(new i = 0; i != sizeof(gSAZones); i++ )
    {
        if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
        }
    }
    return 0;
}
https://sampforum.blast.hk/showthread.php?tid=567255
Reply
#2

#pragma unused z
Reply
#3

Quote:
Originally Posted by Clarck
View Post
#pragma unused z
That's pretty bad practice to do.

Best solution is to figure out if you actually need to use the z variable.
If not, then remove it from the script/function.
If you do, then ignore the warning until you actually have finished writing the code that actually utilizes the variable.

pawn Code:
stock Get2DZoneFromCoordinates(Float:x, Float:y, zone[], len = sizeof(zone))
{
    for(new i = 0; i != sizeof(gSAZones); i++ )
    {
        if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
        {
            return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
        }
    }
}
    return 0;
This would be the solution, if you aren't going to need the z variable, which you most likely wont considering its a 2D function.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)