SA-MP Forums Archive
Argument type mismatch (argument 1) - 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: Argument type mismatch (argument 1) (/showthread.php?tid=355096)



Argument type mismatch (argument 1) - Ukko - 28.06.2012

pawn Код:
public AdminChat(color2, playerid, const string[])
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        if(PlayerInfo[playerid][Adminlevel] > 1)
        SendClientMessage(i, color2, string);
        }
        return 1;
}
public OnPlayerText(playerid, text[])
{
    new pname[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    strreplace(pname, '_', ' ');
    format(str, sizeof(str), "%s says: %s", pname, text);
    ProxDetector(30.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
    if(text[0] == '.' && PlayerInfo[playerid][Adminlevel] >= 1)
    {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"AdminChat: %s: %s",string,text[1]);
        AdminChat(string);
    }
    return 1;
}
Error:
pawn Код:
(1667) : error 035: argument type mismatch (argument 1)
Line 1667:
pawn Код:
AdminChat(green,string);



Re: Argument type mismatch (argument 1) - DeathTone - 28.06.2012

line 1667 should be AdminChat(green, playerid, string);


Re: Argument type mismatch (argument 1) - [KHK]Khalid - 28.06.2012

Couldn't find AdminChat(green, string); anywhere in your code. Anyway AdminChat() should be used like that
pawn Код:
AdminChat(color, id, str);
So I guess you should replace
pawn Код:
AdminChat(string);
with
pawn Код:
AdminChat(green, playerid, string);



Re: Argument type mismatch (argument 1) - Ukko - 28.06.2012

Quote:
Originally Posted by DeathTone
Посмотреть сообщение
line 1667 should be AdminChat(green, playerid, string);
Still errors, already tried that, must be something i've done wrong..


forward AdminChat(color2,playerid, const string[]);

Is what i got on top of the script, forgot to write it.


Re: Argument type mismatch (argument 1) - Stevo127 - 28.06.2012

Try writing:

Код:
forward AdminChat(color2, playerid, string[]);
and then:

Код:
public AdminChat(color2, playerid, string[])
{
Also, you must follow the format, so:
Код:
AdminChat(green, playerid, string);



Re: Argument type mismatch (argument 1) - Ukko - 28.06.2012

Stevo127, It doesnt work, I'm still getting the same error over and over again.


Re: Argument type mismatch (argument 1) - Stevo127 - 28.06.2012

Scratch that...

Paste the full function within which Line 1667 is located.


Re: Argument type mismatch (argument 1) - [KHK]Khalid - 28.06.2012

Can you show the defination of (green) ? 'cause everything compiled fine here when I defined green my way.


Re: Argument type mismatch (argument 1) - milanosie - 28.06.2012

pawn Код:
public AdminChat(color2, playerid, const string[])
Remove the const and change it to this:

pawn Код:
public AdminChat(color2, playerid,string[])
And use it like this

pawn Код:
AdminChat(0x9EC73DAA, playerid, string);



Re: Argument type mismatch (argument 1) - Ukko - 29.06.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
pawn Код:
public AdminChat(color2, playerid, const string[])
Remove the const and change it to this:

pawn Код:
public AdminChat(color2, playerid,string[])
And use it like this

pawn Код:
AdminChat(0x9EC73DAA, playerid, string);
Weird, that actually solved my issue, seems like it doesnt allow me to define colors with "{B700FF}"
Dont know if that's the right way to define colors but they work on playerconnect so..