Jump to content

Weather by area


fairyoggy

Recommended Posts

Hello! Can Is it possible to tie the weather to a specific location?

For example, rain in Los Santos and clear weather in Las Venturas.

The player who is in Los Santos sees the rain but player who is in Las Venturas see clear weather(sunny etc)

That is, at the same time that there was different weather in different states. Is it possible?

Link to comment
3 hours ago, slapztea said:

Hello! Can Is it possible to tie the weather to a specific location?

For example, rain in Los Santos and clear weather in Las Venturas.

The player who is in Los Santos sees the rain but player who is in Las Venturas see clear weather(sunny etc)

That is, at the same time that there was different weather in different states. Is it possible?

getZoneName
setWeather

client side

Link to comment
20 hours ago, Simple. said:

getZoneName
setWeather

client side

@Simple. can you help? 

How to check when a player changes location? Does the weather automatically change?

I can do, for example, command check location BUT how to make it so that when the player changed the location the command worked on this event without a command.

 

Link to comment

Dear slapztea,

your problem sounds very similar to a question that has been asked before:

Other than that, if you want to define custom zones then just use colshape rectangles with the onClientColShapeHit event.

Edited by The_GTA
  • Like 1
Link to comment
16 minutes ago, The_GTA said:

Dear slapztea,

your problem sounds very similar to a question that has been asked before:

Other than that, if you want to define custom zones then just use colshape rectangles with the onClientColShapeHit event.

@The_GTA Thank you, but I don’t think I need custom zones. If use this example, I would like it to work like this. For example, the user is in one location and as soon as he has changed it sounds playing.

That is, I just need to check for a change in location

Edited by slapztea
Link to comment
30 minutes ago, slapztea said:

@Simple. can you help? 

How to check when a player changes location? Does the weather automatically change?

I can do, for example, command check location BUT how to make it so that when the player changed the location the command worked on this event without a command.

 

use timer

Link to comment

Sure, the easiest way to check for location change is the onClientRender event in combination with the getZoneName function. Here is a small example.

local last_zone = false;

local function on_zone_change(zone_name)
  -- TODO: new zone is in the "zone_name" variable.
  -- do something here to change the weather.
end

local function get_relevant_position()
  local cam_target = getCameraTarget();
  
  if (cam_target) then
    return getElementPosition(cam_target);
  end
  
  return getElementPosition(getCamera());
end

addEventHandler("onClientRender", root, function()
    local px, py, pz = get_relevant_position();
    local cur_zone = getZoneName(px, py, pz);
    
    if not (last_zone) or not (last_zone == cur_zone) then
      on_zone_change(cur_zone);
      last_zone = cur_zone;
    end
  end
);

This code does use the position of the camera target or of the camera, depending on what makes most sense.

Edited by The_GTA
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...