WARHAN Posted June 14, 2010 Share Posted June 14, 2010 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
50p Posted June 14, 2010 Share Posted June 14, 2010 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
WARHAN Posted June 22, 2010 Author Share Posted June 22, 2010 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
50p Posted June 22, 2010 Share Posted June 22, 2010 What do you mean throws in front? Make sure animation name is correct and all optional parameters are what you expect them to be. Link to comment
WARHAN Posted June 22, 2010 Author Share Posted June 22, 2010 What do you mean throws in front? Make sure animation name is correct and all optional parameters are what you expect them to be. Player abruptly changed his position during the animation Link to comment
WARHAN Posted June 22, 2010 Author Share Posted June 22, 2010 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
50p Posted June 22, 2010 Share Posted June 22, 2010 That's what I thought just wanted to make sure : ) Link to comment
WARHAN Posted June 22, 2010 Author Share Posted June 22, 2010 Thank you all. Close PS 50p thanks for the speedometer. Using this code, I wrote a nice progress bar for my gym Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now