SA-MP Forums Archive
how do i fix? - 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: how do i fix? (/showthread.php?tid=64747)



how do i fix? - blastervirus - 07.02.2009

Код:
C:\DOCUME~1\Ben\BUREAU~1\GTASCR~1\NORMAA~1.PWN(1091) : warning 235: public function lacks forward declaration (symbol "PirateShipScoreUpdate")
C:\DOCUME~1\Ben\BUREAU~1\GTASCR~1\NORMAA~1.PWN(1104) : warning 235: public function lacks forward declaration (symbol "PayPlayerInArea")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
ty


Re: how do i fix? - Nimphious - 07.02.2009

Quote:
Originally Posted by blastervirus
Код:
C:\DOCUME~1\Ben\BUREAU~1\GTASCR~1\NORMAA~1.PWN(1091) : warning 235: public function lacks forward declaration (symbol "PirateShipScoreUpdate")
C:\DOCUME~1\Ben\BUREAU~1\GTASCR~1\NORMAA~1.PWN(1104) : warning 235: public function lacks forward declaration (symbol "PayPlayerInArea")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
ty
pawn Код:
forward PirateShipScoreUpdate()
forward PayPlayerInArea)
Put it at top of the script.


Re: how do i fix? - blastervirus - 07.02.2009

still got same errors

here is pastebin: http://pastebin.com/fd6eebac

i hope this will help you further


Re: how do i fix? - Extremo - 07.02.2009

just a little note, its
pawn Код:
forward PayPlayerInArea();
forward PirateShipScoreUpdate();
also, i would really suggest you to use a macro for these things, way easier

pawn Код:
#define fpublic%1(%2) forward %1(%2); public %1(%2)
and then, when making a public function, you will use:
pawn Код:
fpublic Function(params)
instead of
pawn Код:
forward Function(params)
public Function(params)
EDIT: You forgot the semicolons, try my way, it will help you :P

EDIT 2: here the pastebin, so you see a example
http://pastebin.com/d67e5175d


Cheers.


Re: how do i fix? - blastervirus - 07.02.2009

but what i want still doesn't works
(givemoney on LV pirate ship)


Re: how do i fix? - [WS]Hyper - 07.02.2009

Woh Extremo that's genious
Maybe I'll use that too, spares me a lot of lines too xD

EDIT: Does that fpublic thing also works for Floats?
So for:

forward Float:GetDistanceBetweenPlayers(p1,p2); for example?


Re: how do i fix? - Extremo - 07.02.2009

It should work fine Hypar. Btw that wasn't genious, that was just thinking like a lazy programmer lol. And blastervirus, what doesnt work? Could you describe it a bit more please?


Re: how do i fix? - Nero_3D - 07.02.2009

lol its marvellous how easy it is to impress "not so good" scritpers with macros XD (no offense)

@Blastervirus

You never called the public PirateShipScoreUpdate so it couldnt work
Now here again the same (copied from Extremo's posted pastebin link)
Just with the Timer at OnGameModeInit which calls each second PirateShipScoreUpdate

pawn Код:
#define fpublic%1(%2) forward%1(%2); public%1(%2)
pawn Код:
//OnGameModeInit
SetTimer(#PirateShipScoreUpdate, 1000, true);
pawn Код:
fpublic PirateShipScoreUpdate()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        PayPlayerInArea(i, 1995.5, 1518.0, 2006.0, 1569.0, 200);
        PayPlayerInArea(i, 1516.1332, -1380.5281, 1568.4066, -1336.3019, 200);
        PayPlayerInArea(i, -1988.4744, 639.1348, -1917.0579, 715.5820, 200);
    }
}
pawn Код:
fpublic 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)
            return GivePlayerMoney(playerID, cash);
    }
    return false;
}



Re: how do i fix? - [WS]Hyper - 08.02.2009

♣ ⓐⓢⓢ, I already helped him on MSN, everything works fine now.

And Extremo, you're still a genious xD