SA-MP Forums Archive
What's wrong with my weather changer? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong with my weather changer? (/showthread.php?tid=569676)



What's wrong with my weather changer? - LeXuZ - 01.04.2015

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)



Re: What's wrong with my weather changer? - CalvinC - 01.04.2015

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



Respuesta: What's wrong with my weather changer? - alexus - 01.04.2015

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));


Re: What's wrong with my weather changer? - Threshold - 01.04.2015

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


Re: What's wrong with my weather changer? - justice96 - 01.04.2015

Code:
forward Weatherst();
public Weatherst()



Re: What's wrong with my weather changer? - LeXuZ - 02.04.2015

Thanks! +rep for the help!