Argument type mismatch (argument 2)
#1

Hi, I've used this code:

Код:
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}

stock GetName(playerid)
{
    new
        name[24];
    GetPlayerName(playerid, name, sizeof(name));
    strreplace(name, "_", " ");
    return name;
}
And I'm getting this error:

Код:
C:\Users\Yakir\Desktop\The Best Server\gamemodes\GM.pwn(310) : error 035: argument type mismatch (argument 2)
Help will be appreciated.
Reply
#2

Show the line?
Reply
#3

Which line?
Reply
#4

Line 310
Reply
#5

The one you get the error on..

EDIT:

@Costel: I know right xD
Reply
#6

Код:
C:\Users\Yakir\Desktop\The Best Server\gamemodes\GM.pwn(310) : error 035: argument type mismatch (argument 2)
Line 310.

EDIT: 3 comments in few seconds, lol. xD
Reply
#7

Ok, I'll show ya but first I'll add another code I forgot to show ya, lol.

Ok so that's the original code:

Код:
stock GetName(playerid)
{
    new szName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, szName, sizeof(szName));
    return szName;
}

stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}

stock GetName(playerid)
{
    new
        name[24];
    GetPlayerName(playerid, name, sizeof(name));
    strreplace(name, "_", " ");
    return name;
}
The two errors:
Код:
C:\Users\Yakir\Desktop\The Best Server\gamemodes\GM.pwn(313) : error 021: symbol already defined: "GetName"
C:\Users\Yakir\Desktop\The Best Server\gamemodes\GM.pwn(317) : error 035: argument type mismatch (argument 2)
And line 313 = "{" which is under: "stock GetName(playerid)"
Line 317 = strreplace(name, "_", " ");
Reply
#8

Make line 313 to (

and line 317 to

pawn Код:
strreplace(name, _, );

I donno if that work.
Reply
#9

For one, you can't have two stocks named the exact same thing...

and then for your strreplace stock you have find and replace set as normal variables, they need to be strings.
Reply
#10

Quote:
Originally Posted by PrawkC
Посмотреть сообщение
For one, you can't have two stocks named the exact same thing...

and then for your strreplace stock you have find and replace set as normal variables, they need to be strings.
This
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)