SA-MP Forums Archive
number of arguments does not match definition - 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: number of arguments does not match definition (/showthread.php?tid=286930)



number of arguments does not match definition - rapidhost - 01.10.2011

pawn Код:
public DisplayDialogForPlayer(playerid, dialogid)
{
    new mstring[1500], titlestring[32], line1[512], line2[512], line3[256];
    new string[128];
    switch(dialogid)
    {
        case 1: ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.","Login","Quit",PlayerName(playerid));
ERROR: number of arguments does not match definition

Help?


Re: number of arguments does not match definition - Jafet_Macario - 01.10.2011

You can't use ShowPlayerDialog like that. Here is an example:

pawn Код:
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string,sizeof(string),"Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.", name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");



Re: number of arguments does not match definition - rapidhost - 01.10.2011

huh?


Re: number of arguments does not match definition - Cjgogo - 01.10.2011

You're doing something wrong

pawn Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.","Login","Quit",PlayerName(playerid));
Wrong is PlayerName(playerid).Why?Well,PAWN reads that as an argument,and ShowPlayerDialog has only 7 arguments not 8(the 8th being PlayerName(playerid));

Just do:

pawn Код:
new dialogmessage[120];
    format(dialogmessage,sizeof(dialogmessage),"Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.",PlayerName(playerid));
   ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",dialogmessage,"Login","Quit");



Re: number of arguments does not match definition - rapidhost - 01.10.2011

If i add that, my pawno crashes.

How should I integrate that into this:

pawn Код:
public DisplayDialogForPlayer(playerid, dialogid)
{
    new mstring[1500], titlestring[32], line1[512], line2[512], line3[256];
    new string[128];
    new dialogmessage[120];
    switch(dialogid)
    {
        case 1: ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome back to ***HIDDEN*** %s .\n\n{ACB9B7}That name is registered. please enter your password below.","Login","Quit",PlayerName(playerid));



Re: number of arguments does not match definition - rapidhost - 01.10.2011

it all happens because of this part:

pawn Код:
"Login",dialogmessage,
dialogmessage part isn't in blue or w/e.. It is read as a function, which it clearly is not.


Re: number of arguments does not match definition - Cjgogo - 01.10.2011

excuse me but how is possible for me and Jaffet is working?

EDIT:OMG,you forgot to copy the format of dialogmessage and you're saying that if it doesn't have " and " and it's not blue it's read as a function?I clearley defined it as a string and you forgot to format IT(AND I made the format for you,Jafet did,so follow the steps carefully)


Re: number of arguments does not match definition - Jafet_Macario - 01.10.2011

pawn Код:
public DisplayDialogForPlayer(playerid, dialogid)
{
    new mstring[1500], titlestring[32], line1[512], line2[512], line3[256];
    new string[128];
    new dialogmessage[120];
    switch(dialogid)
    {
        case 1:
        {
            new string[128];
            format(string,sizeof(string),"Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.",PlayerName(playerid));
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");
        }



Re: number of arguments does not match definition - rapidhost - 01.10.2011

errors:

pawn Код:
: error 002: only a single statement (or expression) can follow each "case"
 : warning 215: expression has no effect
 : error 014: invalid statement; not in switch
 warning 215: expression has no effect
error 001: expected token: ";", but found ":"
error 029: invalid expression, assumed zero
 fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.


ON LINES:
       format(string,sizeof(string),"Welcome back to***HIDDEN***, %s .\n\nThat name is registered. please enter your password below.", name);
        case 1: ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",string,"Login","Quit");



Re: number of arguments does not match definition - rapidhost - 01.10.2011

One warning, with Jafet's code.

Shows string as a double.

Cause there's two STRING [128]

what now?