SA-MP Forums Archive
error 010: invalid function or 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)
+--- Thread: error 010: invalid function or declaration (/showthread.php?tid=603428)



error 010: invalid function or declaration - Progamerisrael1 - 23.03.2016

if(!strcmp("/Updates", cmdtext, true))
{
ShowPlayerDialog(playerid, 1239, DIALOG_STYLE_MSGBOX, "Updates", "23/03/2016/nNew Objects and /sb command", "Done", "Done");

return 1;
}


Re: error 010: invalid function or declaration - AndySedeyn - 23.03.2016

That has to come inside the curly brackets of the OnPlayerCommandText callback:
PHP код:
public OnPlayerCommandText(playeridcmdtext[]) {
    if(!
strcmp("/Updates"cmdtexttrue))
    {
        
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""23/03/2016/nNew Objects and /sb command""Done""Done");
        return 
1;
    }
    return 
0;

Also, you can remove the second button of a dialog by leaving the second one empty:
PHP код:
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""....""Done"""); 



Re: error 010: invalid function or declaration - Progamerisrael1 - 23.03.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
That has to come inside the curly brackets of the OnPlayerCommandText callback:
PHP код:
public OnPlayerCommandText(playeridcmdtext[]) {
    if(!
strcmp("/Updates"cmdtexttrue))
    {
        
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""23/03/2016/nNew Objects and /sb command""Done""Done");
        return 
1;
    }
    return 
0;

Also, you can remove the second button of a dialog by leaving the second one empty:
PHP код:
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""....""Done, ""); 
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41953) : error 021: symbol already defined: "OnPlayerCommandText"
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41957) : error 037: invalid string (possibly non-terminated string)
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41957) : warning 215: expression has no effect
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41957) : error 001: expected token: ";", but found ")"
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41957) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\Server\gamemodes\server.pwn( 41957) : fatal error 107: too many error messages on one line
-------------------------------------------------

It's what I put -
public OnPlayerCommandText(playerid, cmdtext[]) {

if(!strcmp("/Updates", cmdtext, true))
{
ShowPlayerDialog(playerid, 1239, DIALOG_STYLE_MSGBOX, "Updates", "23/03/2016/nNew Objects and /sb command", "Done, "");
return 1;
}
return 0;
}


Re: error 010: invalid function or declaration - AndySedeyn - 23.03.2016

Don't copy paste my code. You have to look what I did. I put your code in the OnPlayerCommandText callback.

Error 037 was my fault:
PHP код:
"Done 
Should be
PHP код:
"Done" 
EDIT: You already have OnPlayerCommandText in your gamemode. Just put that command under the existing commands.


Re: error 010: invalid function or declaration - Progamerisrael1 - 23.03.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
That has to come inside the curly brackets of the OnPlayerCommandText callback:
PHP код:
public OnPlayerCommandText(playeridcmdtext[]) {
    if(!
strcmp("/Updates"cmdtexttrue))
    {
        
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""23/03/2016/nNew Objects and /sb command""Done""Done");
        return 
1;
    }
    return 
0;

Also, you can remove the second button of a dialog by leaving the second one empty:
PHP код:
ShowPlayerDialog(playerid1239DIALOG_STYLE_MSGBOX"Updates""....""Done"""); 
Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
Don't copy paste my code. You have to look what I did. I put your code in the OnPlayerCommandText callback.

Error 037 was my fault:
PHP код:
"Done 
Should be
PHP код:
"Done" 
EDIT: You already have OnPlayerCommandText in your gamemode. Just put that command under the existing commands.
Fixed, thank you mate, you did my day