Abit of help here. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Abit of help here. (
/showthread.php?tid=140715)
Abit of help here. -
Lorenc_ - 10.04.2010
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.
Re: Abit of help here. -
[HiC]TheKiller - 10.04.2010
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.
Re: Abit of help here. -
Lorenc_ - 10.04.2010
EDIT
Код:
error 025: function heading differs from prototype
Re: Abit of help here. -
Lorenc_ - 10.04.2010
help!
Re: Abit of help here. -
Khelif - 10.04.2010
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)
Re: Abit of help here. -
Lorenc_ - 10.04.2010
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