PDA

View Full Version : What's wrong with my weather changer?


LeXuZ
01/04/2015, 04:45 PM
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

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:
(151) : error 035: argument type mismatch (argument 1)

CalvinC
01/04/2015, 05:12 PM
You don't need a 2D array, just use it like this:
new Weathers[] =
{
8,
9,
19
};

alexus
01/04/2015, 05:13 PM
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));

Threshold
01/04/2015, 10:48 PM
Two mistakes. Remove the playerid parameter from the public function and change SetPlayerWeather to SetWeather.

justice96
01/04/2015, 11:50 PM
forward Weatherst();
public Weatherst()

LeXuZ
02/04/2015, 03:48 PM
Thanks! +rep for the help!