Sign in to follow this  
TH3RM4L

I need a simple time/weather change script

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.