SA-MP Forums Archive
error 035: argument type mismatch (argument 2) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 035: argument type mismatch (argument 2) (/showthread.php?tid=181115)



error 035: argument type mismatch (argument 2) - Matthew_Johnston - 04.10.2010

Hey Guys, Im Trying to make a Bartender Command That has 2 Name Strings in it.

Quote:

if (strcmp("/barsell", cmdtext, true, 5) == 0)
{
new tmp[30];
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
new str[128];
new seller;
new sellerid;
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(seller, sendername, sizeof(sellerid));
format(str, sizeof(str), "%s Gave %s a Drink", sendername, sellerid, sendername, str, cmdtext[9]);
SendClientMessageToAll(0xC2A2DAAA, str);
if(IsPlayerConnected(otherplayer))
{
format(str, sizeof(str), "%s Gave You a Drink", sendername, str, cmdtext[9]);
}
return 1;
}

But I Keep getting an Error "Argument 2" Im sure this is Pretty Simple Actually. Im not sure how to go about fixing it. Any help would be Appreciated.
kthxbai


Re: error 035: argument type mismatch (argument 2) - Crayon - 04.10.2010

I'm brand new to scripting but whenever I get this error message it's most likely because my parameters are not in the right order.

Try switching "/barsell" and cmdtext around? Sorry if that is a stupid suggestion, or if I am wrong.


Re: error 035: argument type mismatch (argument 2) - samgreen - 04.10.2010

What line is the error on?


Re: error 035: argument type mismatch (argument 2) - Rachael - 04.10.2010

pawn Код:
if (strcmp("/barsell", cmdtext, true, 5) == 0)
{
     new tmp[30];
     tmp = strtok(cmdtext, idx);
     new otherplayer = strval(tmp);
     if(IsPlayerConnected(otherplayer))
     {
          new str[128];
          new othername[24];
          GetPlayerName(playerid, sendername, sizeof(sendername));
          GetPlayerName(otherplayer, othername, sizeof(othername));
          format(str, sizeof(str), "%s Gave %s a Drink", sendername, othername);
          SendClientMessageToAll(0xC2A2DAAA, str);
          format(str, sizeof(str), "%s Gave You a Drink", sendername);
          SendClientMessage(otherplayer,0xC2A2DAAA,str);
          // maybe more code here? what does drinking do to the player?
          return 1;
     }
     SendClientMessage(playerid,0xC2A2DAAA,"Invalid player");
     return 1;
}
your script was a mess.


Re: error 035: argument type mismatch (argument 2) - Matthew_Johnston - 04.10.2010

(Removed)


Re: error 035: argument type mismatch (argument 2) - Calgon - 04.10.2010

pawn Код:
sizeof(sellerid)
Might contribute to your errors, seeing as variable 'sellerid' is an integer, and not a string.


Re: error 035: argument type mismatch (argument 2) - Toni - 04.10.2010

Quote:
Originally Posted by Matthew_Johnston
Посмотреть сообщение
xD Naw There in the right Order.
She was talking about your indentation. And also yes. You have horrible coding formats. No offense.


Re: error 035: argument type mismatch (argument 2) - Matthew_Johnston - 04.10.2010

Still Not Working
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP4.pwn(542) : error 035: argument type mismatch (argument 2)
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP4.pwn(542) : error 035: argument type mismatch (argument 2)'

Those 2 Lines are the GetPlayerName


Re: error 035: argument type mismatch (argument 2) - Rachael - 04.10.2010

go to the line with the error, look at argument 2, probably sendername.
then find where you have defined 'new sendername', if it is not a string, ie 'new sendername[24]; then make it so.


Re: error 035: argument type mismatch (argument 2) - Toni - 04.10.2010

Quote:
Originally Posted by Matthew_Johnston
Посмотреть сообщение
Still Not Working
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP4.pwn(542) : error 035: argument type mismatch (argument 2)
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP4.pwn(542) : error 035: argument type mismatch (argument 2)'

Those 2 Lines are the GetPlayerName
Declare sendername.