SA-MP Forums Archive
Get Weather - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get Weather (/showthread.php?tid=74656)



Get Weather - Justsmile - 24.04.2009

I set a weather for one player, but how can i get the weather on the Server again? and set for the player?


Re: Get Weather - Backwardsman97 - 24.04.2009

Store the server's current weather in a variable and set it to that when you change it back.


Re: Get Weather - Justsmile - 24.04.2009

I dont know how. Can you please make a example?


Re: Get Weather - Backwardsman97 - 24.04.2009

pawn Code:
new ServerWeather; //At the top

//When you set the weather
SetWeather(2); //For example 2
ServerWeather = 2;

//When you change the player's weather back
SetPlayerWeather(playerid,ServerWeather);



Re: Get Weather - Justsmile - 25.04.2009

nope its just easier. I will explain, maybe someone need this. If you use a Change Weather system just set under the public functions:

On the Top
new GetWeather;

Public
....
your weather description = GetWeather

That's just is it

But thanks.


Re: Get Weather - -Davee- - 25.04.2009

-


Re: Get Weather - Andom - 25.04.2009

For SetWeather:
Code:
forward SetWeatherEx(weatherid);
forward GetWeather();

new CurrentWeather;

public SetWeatherEx(weatherid)
{
  SetWeather(weatherid);
  CurrentWeather = weatherid;
}

public GetWeather()
{
  return CurrentWeather;
}
And replace all the ''SetWeather'' to ''SetWeatherEx'' with the ctrl+h function.
And now you get use ''GetWeather'' everytime you want

For SetPlayerWeather:
Code:
forward SetPlayerWeatherEx(playerid, weatherid);
forward GetPlayerWeather(playerid);

new CurrentWeather[MAX_PLAYERS];

public SetPlayerWeatherEx(playerid, weatherid)
{
  SetPlayerWeather(playerid, weatherid);
  CurrentWeather[playerid] = weatherid;
}

public GetPlayerWeather(playerid)
{
  return CurrentWeather[playerid];
}
And replace all the ''SetPlayerWeather'' to ''SetPlayerWeatherEx'' with the ctrl+h function.
And now you get use ''GetPlayerWeather'' everytime you want


Re: Get Weather - Justsmile - 25.04.2009

оs my example wrong?