argument type mismatch (argument 2)
#1

Hi,
getting the error while trying to get the inputtext, from the input dialog to strcmp. Any ideas?

Код HTML:
.pwn(13227) : error 035: argument type mismatch (argument 2)
.pwn(13236) : warning 213: tag mismatch
.pwn(13237) : warning 213: tag mismatch
Код HTML:
if(dialogid == 1059)
    {
        if(!response) // If they clicked 'Cancel' or pressed esc
        {
            SendClientMessage(playerid,0xFF0000,"* Good Luck");
        }
        else // Pressed ENTER or clicked 'Login' button
        {
            if(strcmp(inputtext, 0, true) // line 13227
            {
                new vardas[MAX_PLAYER_NAME], Pdb_ZP_name[41];
                strmid(vardas,inputtext,0,MAX_PLAYER_NAME);
                new id = GetPlayeridMid(vardas);
                if (id == INVALID_PLAYER_ID){ SendClientMessage(playerid, RED, "* No player found"); return 1;}
                GetPlayerName(playerid, vardas, MAX_PLAYER_NAME);
                format(Pdb_ZP_name, sizeof(Pdb_ZP_name), "%s", vardas);
                TextDrawSetString(Pdb_ZP[playerid][6], Pdb_ZP_name);    // line 13236
                TextDrawShowForPlayer(playerid, Pdb_ZP[playerid][6]);  // line 13237

                for(new k; k < 15; k++)
                PlayerTextDrawShow(playerid,Pdb_ZP[playerid][k]);
                IsPdbOpen[playerid] = 1;
            return 1;
            }
            else
            {
                SendClientMessage(playerid,0xFF0000,"*No player found");
 
                // Re-show the login dialog
                ShowPlayerDialog(playerid,1059, DIALOG_STYLE_INPUT, "Test", "Search player by name:", "Search", "close");
            }
        }
        return 1;
    }
Thanks a lot
Reply
#2

PHP код:
    if(dialogid == 1059)
    {
        if(!
response// If they clicked 'Cancel' or pressed esc
        
{
            
SendClientMessage(playerid,0xFF0000,"* Good Luck");
        }
        else 
// Pressed ENTER or clicked 'Login' button
        
{
            if(
strcmp(inputtext"0"true)) // line 13227
            
{
                new 
vardas[MAX_PLAYER_NAME], Pdb_ZP_name[41];
                
strmid(vardas,inputtext,0,MAX_PLAYER_NAME);
                new 
id GetPlayeridMid(vardas);
                if (
id == INVALID_PLAYER_ID){ SendClientMessage(playeridRED"* No player found"); return 1;}
                
GetPlayerName(playeridvardasMAX_PLAYER_NAME);
                
format(Pdb_ZP_namesizeof(Pdb_ZP_name), "%s"vardas);
                
TextDrawSetString(Text:Pdb_ZP[playerid][6], Pdb_ZP_name);    // line 13236
                
TextDrawShowForPlayer(playeridText:Pdb_ZP[playerid][6]);  // line 13237
                
for(new k15k++)
                
PlayerTextDrawShow(playerid,Pdb_ZP[playerid][k]);
                
IsPdbOpen[playerid] = 1;
            return 
1;
            }
            else
            {
                
SendClientMessage(playerid,0xFF0000,"*No player found");
 
                
// Re-show the login dialog
                
ShowPlayerDialog(playerid,1059DIALOG_STYLE_INPUT"Test""Search player by name:""Search""close");
            }
        }
        return 
1;
    } 
you were passing integer parameter to strcmp function | 0 | which had to be: | "0" |

also other error probably missing Text: tag for Pdb_ZPvar, so add it on its define. ex: new Text:Pdb_ZP...
Reply
#3

PHP код:
if(strcmp(inputtext0true
STRCMP is short of String Compare, you are trying to compare an integer (0) with a string (inputtext).

For the other two errors, it seems that the variable Pdb_ZP[x][x] is not properly tagged, is it?
Reply
#4

Thank you! So far, i understand, what's the Problem, but have no idea, what second should i compare with. I want, to compare inputtext, with the Online player name, and if found, open the Textdraw.
Reply
#5

Quote:
Originally Posted by NBass
Посмотреть сообщение
Thank you! So far, i understand, what's the Problem, but have no idea, what second should i compare with. I want, to compare inputtext, with the Online player name, and if found, open the Textdraw.
http://forum.sa-mp.com/showpost.php?...61&postcount=2

so we're going to replace
PHP код:
            if(strcmp(inputtext0true// line 13227 
with

PHP код:
            new id GetPlayerIdFromName(inputtext);
            if(
id != INVALID_PLAYER_ID
and don't forget to add the function

http://forum.sa-mp.com/showpost.php?...61&postcount=2

then replace this:
PHP код:
                new vardas[MAX_PLAYER_NAME], Pdb_ZP_name[41]; 
                
strmid(vardas,inputtext,0,MAX_PLAYER_NAME); 
                new 
id GetPlayeridMid(vardas); 
with
PHP код:
                new Pdb_ZP_name[41]; 
Reply
#6

Thanks, seems working!

Do you maybe know, how can i get a Player name to the Textdraw now? Anyway, thanks for help, letting me understand, how all this works.

Quote:

new Pdb_ZP_name[41];
format(Pdb_ZP_name, sizeof(Pdb_ZP_name), "%s", id); // maybe id, but seems not working.
PlayerTextDrawSetString(playerid, Pdb_ZP[playerid][7], Pdb_ZP_name);
PlayerTextDrawShow(playerid,Pdb_ZP[playerid][7]);

Reply
#7

Quote:
Originally Posted by NBass
Посмотреть сообщение
Thanks, seems working!

Do you maybe know, how can i get a Player name to the Textdraw now? Anyway, thanks for help, letting me understand, how all this works.
you can do a simple change on the function to put the exact new name which found, on the string which passed.

->
Код:
stock GetPlayerIdFromName(playername[])
{
  for(new i = 0; i <= MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      new playername2[MAX_PLAYER_NAME];
      GetPlayerName(i, playername2, sizeof(playername2));
      if(strcmp(playername2, playername, true, strlen(playername)) == 0)
      {
        format(playername, sizeof playername2,  playername2);
        return i;
      }
    }
  }
  return INVALID_PLAYER_ID;
}
and later:

PHP код:
format(Pdb_ZP_namesizeof(Pdb_ZP_name), "%s"id); // maybe id, but seems not working. 
to ->
PHP код:
format(Pdb_ZP_namesizeof(Pdb_ZP_name), "%s"inputtext); // maybe id, but seems not working. 
Reply
#8

It works! Thanks to all Replies!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)