Log in

View Full Version : [Bug] CallPublic



Debug
07-20-2013, 09:42 PM
Hi, when I want to call the public, I get an error: Public with name _test does not exist

code:


//OnGameModeInit
CallPublic ( cmdname, ID, " " ) ; //cmdname = "_test"

//separate public
forward _test( playerid, params { } ) ;
public _test( playerid, params { } ) { return print ( "Test Command" ) ;}

debug log: https://pastebin.com/078tjL6u

foxtacles
07-20-2013, 09:48 PM
You can only call functions which have been made public with MakePublic (<- click the link). This should work:



//OnGameModeInit
MakePublic("_test", "_test", "is");
CallPublic ( cmdname, ID, " " ) ; //cmdname = "_test"

//separate public
forward _test( playerid, params { } ) ;
public _test( playerid, params { } ) { return print ( "Test Command" ) ;}


This is so these functions can be called from C/C++ scripts as well (and vice-versa).