Get Weather
#1

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

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

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

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);
Reply
#5

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.
Reply
#6

-
Reply
#7

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
Reply
#8

оs my example wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)