Jump to content

I need a simple time/weather change script


Recommended Posts

Posted (edited)

Hello. I'm new at scripting and I've been struggling to make a simple time/weather changer.

I tried to do it like this:

mp.events.addCommand('time', (player, _, timeA) => {
    if (timeA().length > 0)
    {
        setTime(parseInt(timeA));
    }
});

mp.events.addCommand('weather', (player, _, weatherA) => {
    if (weatherA().length > 0)
    {
        setWeather(parseInt(weatherA));
    }
});

Could anyone, if kind enough, show me how to properly make this work? I wanna learn how to do this stuff :D

Thanks in advance.

Edited by TH3RM4L
Posted
2 hours ago, TH3RM4L said:

setTime(parseInt(timeA));

mp.world.time.hour = parseInt(timeA);

 

2 hours ago, TH3RM4L said:

setWeather(parseInt(weatherA));

mp.world.weather = weatherA;

 

2 hours ago, TH3RM4L said:

if (timeA().length > 0)

() not needed. It's not a function, it's a variable.

 

  • Like 1

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...