Sign in to follow this  
linglingthething

How to set a timer correct ?

Recommended Posts

Hey hey

I Got a question. At GT-MP i can set a timer like this

Task.Run(() => {
                CharacterTimer = API.SetTimer(60000, false, () =>
                {
                    API.getAllPlayers().ForEach(client => {
                        if (client.hasData("player"))
                        {
                            Player player = client.getData("player");
                            if (player.Character != null)
                            {
                                player.Character.Position = client.position;
                                player.Character.Rotation = client.rotation;
                                CharacterService.UpdatePlayerWeapons(player.Character);

                                if (!player.Character.IsDeath)
                                {
                                    player.Character.Hunger -= 2;
                                    player.Character.Thirst -= 3;

                                    if (player.Character.Thirst <= 20)
                                    {
                                        NAPI.Notification.SendNotificationToPlayer(client, "Du hast für eine weile nix mehr getrunken!");
                                    }

                                    if (player.Character.Hunger <= 15)
                                    {
                                        NAPI.Notification.SendNotificationToPlayer(client, "Du hast für eine seit einer weile nix mehr gegessen!");
                                    }

                                    if (player.Character.Hunger <= 0 || player.Character.Thirst <= 0)
                                    {
                                        client.health -= 10;
                                    }
                                    CharacterService.UpdateHUD(client);
                                }
                            }
                        }
                    });
                });
            });

But how can i do it at Rage MP? because API.setTimer is not supported. i Hope anyone can help me to solve this little problem.

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.