ublic function lacks forward declaration? - 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: ublic function lacks forward declaration? (
/showthread.php?tid=205215)
ublic function lacks forward declaration? -
Hudgens - 31.12.2010
Trying to compile after I made my timer, this is the warning I get
Код:
TDM.pwn(279) : warning 235: public function lacks forward declaration (symbol "myfunction")
The code I wrote
under game mode init
Код:
SetTimer("myfunction",200000, 1);
and the function
Код:
public myfunction(playerid)
{
SendClientMessage(playerid, COLOR_YELLOW, "Enjoy your stay at Hudgens Funserver");
return 1;
}
Note: It works fine in-game but I want the code to be clean.
Re: ublic function lacks forward declaration? -
iJumbo - 31.12.2010
add
pawn Код:
forward myfunction(playerid);
Re: ublic function lacks forward declaration? -
Hudgens - 31.12.2010
Do you mean:
Код:
forward myfunction(playerid)
{
SendClientMessage(playerid, COLOR_YELLOW, "Enjoy your stay at Hudgens Funserver");
return 1;
}
Cuz' that aint working .
Re: ublic function lacks forward declaration? -
iJumbo - 31.12.2010
pawn Код:
forward myfunction(playerid);
public myfunction(playerid)
{
SendClientMessage(playerid, COLOR_YELLOW, "Enjoy your stay at Hudgens Funserver");
return 1;
}
Re: ublic function lacks forward declaration? -
Hudgens - 31.12.2010
Oh never mind I solved it now(sorry for double post).
Re: ublic function lacks forward declaration? -
iJumbo - 31.12.2010
good!!
Happy 2011!!
Re: ublic function lacks forward declaration? -
Hudgens - 31.12.2010
Thanks and to you to mate
Re: ublic function lacks forward declaration? - [03]Garsino - 31.12.2010
Your timer is wrong btw, it should be:
pawn Код:
SetTimerEx("myfunction", 200000, 1, "i", playerid);
But then you would need to put it at OnPlayerConnect or something or replace the code in your callback with SendClientMessage
ToAll. Because the code as you have it now will only work for ID 0.
Re: ublic function lacks forward declaration? -
Scenario - 31.12.2010
Quote:
Originally Posted by [03]Garsino
Your timer is wrong btw, it should be:
pawn Код:
SetTimer("myfunction", 200000, 1, "i", playerid);
But then you would need to put it at OnPlayerConnect or something or replace the code in your callback with SendClientMessage ToAll. Because the code as you have it now will only work for ID 0.
|
Actually, it would be "SetTimer
Ex".
Re: ublic function lacks forward declaration? - [03]Garsino - 31.12.2010
Quote:
Originally Posted by RealCop228
Actually, it would be "SetTimerEx".
|
Yeah, I know, I just copied his code so I didn't had to rewrite it, but I forgot to add Ex at the end ^^