warning 202: number of arguments does not match definition -
TomRedlake - 08.08.2013
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();
Re: warning 202: number of arguments does not match definition -
Konstantinos - 08.08.2013
Does EvenTeams have no parameters?
Re: warning 202: number of arguments does not match definition -
TomRedlake - 09.08.2013
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;
}
Re: warning 202: number of arguments does not match definition -
Konstantinos - 09.08.2013
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?
Re: warning 202: number of arguments does not match definition -
TomRedlake - 09.08.2013
just fix warning
Re: warning 202: number of arguments does not match definition -
Iron3man - 09.08.2013
just replace the line with this
public RandomZombie() return EvenTeams(playerid);
Re: warning 202: number of arguments does not match definition -
Konstantinos - 09.08.2013
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..
Re: warning 202: number of arguments does not match definition -
TomRedlake - 09.08.2013
@Iron3Man now i got error that playerid is not defined.
@Konstantinos
Here is code:
OnMapStart function
pawn Код:
SetTimer("RandomZombie",5000,false);
Re: warning 202: number of arguments does not match definition -
Konstantinos - 09.08.2013
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:
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.
Re: warning 202: number of arguments does not match definition -
TomRedlake - 09.08.2013
thank you for help