SA-MP Forums Archive
Default values on custom functions - 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: Default values on custom functions (/showthread.php?tid=387287)



Default values on custom functions - 2KY - 23.10.2012

How would I go about doing this?

PHP код:
forward ShowPlayerTeleportMenuplayeridpage ); 
// This compiles fine, it's when I add the actual function.
public ShowPlayerTeleportMenu playeridpage )
{
    return 
true;

This returns the following error:

Quote:
textdraws.inc(13) : error 059: function argument may not have a default value (variable "page")
textdraws.inc(103) : error 025: function heading differs from prototype




Re: Default values on custom functions - Magic_Time - 24.10.2012

It happened me once I wrote a function incorrectly
textdraws.inc(103) : error 025: function heading differs from prototype


Re: Default values on custom functions - Catalyst- - 24.10.2012

pawn Код:
stock ShowPlayerTeleportMenu(playerid, page = 1)
{
    return true;
}



Re: Default values on custom functions - 2KY - 24.10.2012

Quote:
Originally Posted by Magic_Time
Посмотреть сообщение
It happened me once I wrote a function incorrectly
textdraws.inc(103) : error 025: function heading differs from prototype
If I put = 1 after the public function, this happens;

Quote:

function argument may not have a default value (variable "page")




Re: Default values on custom functions - ViniBorn - 24.10.2012

You tried this?

pawn Код:
ShowPlayerTeleportMenu ( playerid, page = 1 )
{
    return true;
}