warning 202: number of arguments does not match definition
#1

Hello all I have problem.
When i compile my script i got this:

pawn Код:
warning 202: number of arguments does not match definition
Here is line:

pawn Код:
public RandomZombie() return EvenTeams();
Reply
#2

Does EvenTeams have no parameters?
Reply
#3

Here is EvenTeams its stock.
pawn Код:
stock EvenTeams(playerid)
{
    new Humans, Zombies, rand = random(2);
    if(rand == 0) // Setting ID 0 to Human and continuing with the cycle
    {
        foreach(Player, i)
        {
            if(Humans == Zombies)
            {
                HumanSetup2(i);
                Humans ++;
            }
            else
            {
                ZombieSetup2(playerid);
                Zombies ++;
            }
        }
    }
    else // Setting ID 0 to Zombie and continuing with the cycle
    {
        foreach(Player, i)
        {
            if(Humans == Zombies)
            {
                ZombieSetup2(i);
                Zombies ++;
            }
            else
            {
                HumanSetup2(i);
                Humans ++;
            }
        }
    }
    return 1;
}
Reply
#4

EvenTeams function has playerid as a parameters, but you do not use the parameter at all here:

pawn Код:
public RandomZombie() return EvenTeams();
You need to pass a player's ID.

What do you want to do with the above code?
Reply
#5

just fix warning
Reply
#6

just replace the line with this
public RandomZombie() return EvenTeams(playerid);
Reply
#7

I cannot just fix the warning like that, if I do not know what you want to do with it.

Okay, I can stop the compiler from giving you the warning by adding a random playerid, but that's not the point and it's a really bad idea.

May you tell us what RandomZombie is and when do you use EvenTeams?

Quote:
Originally Posted by Iron3man
Посмотреть сообщение
just replace the line with this
public RandomZombie() return EvenTeams(playerid);
playerid is not defined..
Reply
#8

@Iron3Man now i got error that playerid is not defined.

@Konstantinos

Here is code:
pawn Код:
forward RandomZombie();
OnMapStart function
pawn Код:
SetTimer("RandomZombie",5000,false);
Reply
#9

Where do you use OnMapStart function? Let me explain you. EvenTeams needs a player's id in order to work.

If OnMapStart uses a player's id, then you need to assign it to the timer. For example, it would be:
pawn Код:
SetTimerEx("RandomZombie",5000,false, "i", playerid); // an example

// somewhere else
public RandomZombie(playerid) return EvenTeams(playerid);
That would work, if OnMapStart uses player's ID.

On the other hand, if this function is in OnGameModeInit for example or somewhere else, you will need to use a random ID.

But..

if you don't want this line:
pawn Код:
ZombieSetup2(playerid);
Then it can be used like:
pawn Код:
stock EvenTeams()
{
    new Humans, Zombies, rand = random(2);
    if(rand == 0) // Setting ID 0 to Human and continuing with the cycle
    {
        foreach(Player, i)
        {
            if(Humans == Zombies)
            {
                HumanSetup2(i);
                Humans ++;
            }
        }
    }
    else // Setting ID 0 to Zombie and continuing with the cycle
    {
        foreach(Player, i)
        {
            if(Humans == Zombies)
            {
                ZombieSetup2(i);
                Zombies ++;
            }
            else
            {
                HumanSetup2(i);
                Humans ++;
            }
        }
    }
    return 1;
}

// Somewhere else
public RandomZombie() return EvenTeams();
It's up to you.
Reply
#10

thank you for help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)