error 035: argument type mismatch (argument 2)
#1

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
Reply
#2

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.
Reply
#3

What line is the error on?
Reply
#4

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.
Reply
#5

(Removed)
Reply
#6

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

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.
Reply
#8

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
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)