What's wrong with my weather changer?
#1

Hello, so I've been trying to get my server to change its weather randomly, so I started doing something like this, but it kept saying error 035: argument type mismatch (argument 1)

My code

pawn Code:
new Weathers[][] =
{
    {8},
    {9},
    {19}
};

SetTimer("Weatherst", 300000, true); //OnGameModeInit

forward Weatherst(playerid);
public Weatherst(playerid)
{
    new RanWeath = random(sizeof(RanWeath));
    SetWeather(Weathers[RanWeath]);//ERROR line
}
Could you help me, can't see where i've gone wrong :S

ERROR:
Code:
(151) : error 035: argument type mismatch (argument 1)
Reply
#2

You don't need a 2D array, just use it like this:
pawn Code:
new Weathers[] =
{
    8,
    9,
    19
};
Reply
#3

Code:
new Weathers[] =
{
	8,
	9,
	19
};

SetTimer("Weatherst", 300000, true); //OnGameModeInit


forward Weatherst(playerid);

public Weatherst(playerid)
{
    new rand = random(sizeof(Weathers));
    SetPlayerWeather(Weathers[rand]);
}
There was a mistake:
new RanWeath = random(sizeof(RanWeath));
Reply
#4

Two mistakes. Remove the playerid parameter from the public function and change SetPlayerWeather to SetWeather.
Reply
#5

Code:
forward Weatherst();
public Weatherst()
Reply
#6

Thanks! +rep for the help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)