SA-MP Forums Archive
1 Warning need 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: 1 Warning need help (/showthread.php?tid=505447)



1 Warning need help - iThePunisher - 08.04.2014

hmm i tried everything and i cannot fix this lol ....
so here is the warning
pawn Код:
.pwn(172) : warning 203: symbol is never used: "playerid"
and here is the warning line
pawn Код:
stock CheckAimingRobNPC(playerid)



Re: 1 Warning need help - Twizted - 08.04.2014

Can you check us the code where that line is included?


Re: 1 Warning need help - Konstantinos - 08.04.2014

You use "playerid" as parameter there but you don't actually use it.

An example of what you've done:
pawn Код:
stock SayHello(playerid)
{
    print("Hello");
}
It uses playerid as parameter but it doesn't use it inside the function.


Re: 1 Warning need help - iThePunisher - 08.04.2014

Damn i don't get it, -_-
here is all the line ,
may you show me how i fix this ?
pawn Код:
stock CheckAimingRobNPC(playerid)
{
    new targetplayer;

    for (new x = 1; x <= npcnum; x++)
    {
        if(targetplayer == robnpc[x])
        {
            return robnpc[x];
        }
    }

    return INVALID_PLAYER_ID;
}



Re: 1 Warning need help - PrivatioBoni - 08.04.2014

Surely just change:

pawn Код:
stock CheckAimingRobNPC(playerid)
to
pawn Код:
stock CheckAimingRobNPC(targetplayer)
Good luck!


Re: 1 Warning need help - Konstantinos - 08.04.2014

Why do you declare a new variable that it will always be 0 when you can use playerid?

pawn Код:
stock CheckAimingRobNPC(playerid)
{
    for (new x = 1; x <= npcnum; x++)
    {
        if(playerid == robnpc[x])
        {
            return robnpc[x];
        }
    }
   
    return INVALID_PLAYER_ID;
}
Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
Surely just change:

pawn Код:
stock CheckAimingRobNPC(playerid)
to
pawn Код:
stock CheckAimingRobNPC(targetplayer)
Good luck!
No, that will give warning 219: local variable "targetplayer" shadows a variable at a preceding level and another warning that "targetplayer" is never used.


Re: 1 Warning need help - Ari - 08.04.2014

Are you using the function, or is it just being made?

Provide the code where you're calling it as well.