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)
+--- Thread: error 035: argument type mismatch (argument 2) (/showthread.php?tid=524068)



error 035: argument type mismatch (argument 2) - Team_PRO - 05.07.2014

PHP код:
C:\Users\Matt\Desktop\truckingph\gamemodes\truckingph.pwn(4399) : error 035argument type mismatch (argument 2)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if (!
success)
    {
    new 
string[500];
    
format(string,sizeof(string),"PH-BOT: This command has not founded in System %s(%d), Please use /cmds(/commands) or /help For more Info.",GetPName(playerid));
    
SendClientMessage(playeridlredstring);
    }
    return 
1;

i already read this https://sampwiki.blast.hk/wiki/Format but it gave same errors


Re: error 035: argument type mismatch (argument 2) - Ihateyou - 05.07.2014

which fcken line is it ? im guessing u dont have lred defined correctly or some shit


Re: error 035: argument type mismatch (argument 2) - Adityz - 05.07.2014

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if (!
success)
    {
    new 
string[500];
    
format(string,sizeof(string),"PH-BOT: This command has not founded in System %s ---> (%d) <----, Please use /cmds(/commands) or /help For more Info.",GetPName(playerid));
    
SendClientMessage(playeridlredstring);
    }
    return 
1;

there's the error.

replace your code with this -
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if (!
success)
    {
    new 
string[150];
    
format(string,sizeof(string),"PH-BOT: This command has not founded in System %s, Please use /cmds(/commands) or /help For more Info.",GetPName(playerid));
    
SendClientMessage(playeridlredstring);
    }
    return 
1;




Re: error 035: argument type mismatch (argument 2) - Dignity - 05.07.2014

Quote:
Originally Posted by Ihateyou
Посмотреть сообщение
which fcken line is it ? im guessing u dont have lred defined correctly or some shit
Lol, what? He has it defined, if he hadn't it have shown a undefined error. Besides, you should probably try and get rid of your disgusting attitude before you end up getting banned.

@OP:

The format line is alright, although the string size [500] should NOT be 500 unless you use it in a dialog. Your text is 99, and assuming GetRPName returns a name, we end up with 123 since MAX_PLAYER_NAME is 24.

Change the string size to 125 and it'll be fine. For your error, can you show us what your GetRPName(playerid) looks like? When you PMed me, it had two params so it's most likely a param issue.

EDIT: @Adityz The compiler can't detect mistakes that are done in "" tags, so that is not the issue. It only adds on to what I said above, which is a param issue with the function he is trying to get information from.


Re: error 035: argument type mismatch (argument 2) - Team_PRO - 05.07.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
can you show us what your GetRPName(playerid) looks like? When you PMed me, it had two params so it's most likely a param issue.
This one?
PHP код:
GetPName(playerid)) 



Re: error 035: argument type mismatch (argument 2) - Dignity - 05.07.2014

We know you used it like that, but what is the actual code behind that? Paste the full function.


Re: error 035: argument type mismatch (argument 2) - Team_PRO - 05.07.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
We know you used it like that, but what is the actual code behind that? Paste the full function.
Um Anyway Thanks i fixed it already. i just forgot something to it


Re: error 035: argument type mismatch (argument 2) - Threshold - 05.07.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Lol, what? He has it defined, if he hadn't it have shown a undefined error. Besides, you should probably try and get rid of your disgusting attitude before you end up getting banned.

@OP:

The format line is alright, although the string size [500] should NOT be 500 unless you use it in a dialog. Your text is 99, and assuming GetRPName returns a name, we end up with 123 since MAX_PLAYER_NAME is 24.

Change the string size to 125 and it'll be fine. For your error, can you show us what your GetRPName(playerid) looks like? When you PMed me, it had two params so it's most likely a param issue.

EDIT: @Adityz The compiler can't detect mistakes that are done in "" tags, so that is not the issue. It only adds on to what I said above, which is a param issue with the function he is trying to get information from.
"u dont have lred defined correctly". He didn't say it wasn't defined at all, and you don't get banned for being correct.

What he means is 'lred' has been defined as something along the lines of "{FF0000"} rather than 0xFF0000FF. So he's using it as a define for color embedding rather than a hex value.

Simply change:
pawn Код:
#define lred "{FF0000}" //Or whatever you have here...
to:
pawn Код:
#define lred 0xFF0000FF //As above
EDIT: Lol, had this page open for over 20 minutes, probably should have refreshed..


Re: error 035: argument type mismatch (argument 2) - Ihateyou - 06.07.2014

thanks for letting us know you fixed it, and not posting the solution to the problem...

i really love people on this forum so much.. -_-