Jump to content

Progress bar and the freezing


WARHAN

Recommended Posts

I want make gym. I started doing the tread. But there are two problems that I can not explain.

This snippet of code on the server:

function training (player)
 setPedFrozen (player, true)
toggleAllControls (player, false, true, false)
setElementPosition (player, 773.48046, -2.5117, 1000.84)
setPedAnimation (player, "GYMNASIUM", "gym_tread_jog")
setPedRotation (player, 180)
triggerClientEvent ("onTread", getRootElement ())
end
addCommandHandler ("training", training)

Clients:

function createProgressBar ()
 progressBar = guiCreateProgressBar (0.8, 0.8, 0.15, 0.05, true, nil)
guiProgressBarSetProgress (progressBar, 50)
bindKey (player, "space", "down", addGymProgressBar)
end
addEvent ("onTread", true)
addEventHandler ("onTread", getRootElement (), createProgressBar)

The first problem that does not create the progress bar

The second is that the use of frozen animation slips and vice versa.

I hope you will help a beginner:)

Link to comment

1. You don't want to trigger the event for every player, because that would create progress bar for every player: triggerClientEvent( player, "onTread", getRootElement() )

2. Debug your createProgressBar function and check if it's called at all.

Link to comment

The problem with animation is not solved. When I ask animation

setPedAnimation (player, "GYMNASIUM", "gym_tread_jog")

then the player through a period of time then "throws" in front. How to solve the problem? Freese does not solve the problem.

Link to comment

I found a solution.

setPedAnimation (ped thePed [, string block = nil, string anim = nil, int time =- 1, bool loop = true, bool updatePosition = true, bool interruptable = true])

updatePosition = true

Change to false

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