Abit of help here.
#1

Arghh i got this warning and i forgot how to fix it?

Код:
warning 219: local variable "cash" shadows a variable at a preceding level
This is the code where the warning shows.

pawn Код:
public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash)
{
    if(IsPlayerConnected(playerID))
    {
        new Float:X, Float:Y, Float:Z;

        GetPlayerPos(playerID, X, Y, Z);
        if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
        {
            GivePlayerMoney(playerID, cash);
            return 1;
        }
    }
    return 0;
}
Thanks in advanced Lorenc.
Reply
#2

Cash is a variable that is already defined

pawn Код:
public PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash55)
{
    if(IsPlayerConnected(playerID))
    {
        new Float:X, Float:Y, Float:Z;

        GetPlayerPos(playerID, X, Y, Z);
        if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2)
        {
            GivePlayerMoney(playerID, cash55);
            return 1;
        }
    }
    return 0;
}
That should work fine :P.
Reply
#3



EDIT
Код:
error 025: function heading differs from prototype
Reply
#4

help!
Reply
#5

find this function with forward in front of it (behind it). the prototype must be exactly the same. you will receive warnings when it's not the same.
pawn Код:
forward PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash55)
Reply
#6

Quote:
Originally Posted by ⒮⒠⒱⒠⒩⒮⒯⒜⒭
find this function with forward in front of it (behind it). the prototype must be exactly the same. you will receive warnings when it's not the same.
pawn Код:
forward PayPlayerInArea(playerID, Float:x1, Float:y1, Float:x2, Float:y2, cash55)
Thanks SevenStar and thanks [HiC]TheKiller
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)