code123 Posted December 1, 2019 Share Posted December 1, 2019 Hi I have a code and it works from (Object Movement Generator) - server side function omg_movement() omg5036 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 90) omgMoveomg5036(1) omg9139 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 0) omgMoveomg9139(1) end function omgMoveomg5036(point) moveObject(omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end function omgMoveomg9139(point) moveObject(omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end But I need to start it after counting down on the server. (after map loading) function omg_movement() omg5036 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 90) omgMoveomg5036(1) omg9139 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 0) omgMoveomg9139(1) end function omgMoveomg5036(point) moveObject(omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end function omgMoveomg9139(point) moveObject(omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function (new) if (new == "Running") then startomg_movement() end end) I've added some lines but it's still doesn't works. I'm newbie in scripting. Could you help guys ? Link to comment
code123 Posted December 1, 2019 Author Share Posted December 1, 2019 (edited) Edit: or could be another option to create another script with command for start file.Lua (with this movement code inside) after counting down, if it will be easier thing. Can you give me some clue Edited December 1, 2019 by code123 Link to comment
code123 Posted December 2, 2019 Author Share Posted December 2, 2019 Anyone can tell if it is pobbile? To create a code which strart Lua file type server after map count down? If it is, give me please link to the function on mta wiki and I will try to make a code :) Link to comment
Addlibs Posted December 2, 2019 Share Posted December 2, 2019 (edited) addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function (new) if (new == "Running") then startomg_movement() end end) This is my best guess on how to do that, and you already have that in your code. The state "GridCountdown" is apparently the countdown state. The very next state is "Running". Thus, state change from "GridCountdown", or any state tbh, to "Running" should only occur once the countdown is finished. Hence, onRaceStateChanging with new state being "Running" should be triggered just after the countdown ends. Are you sure the code you tested was the one you posted? Perhaps it didn't save and you kept testing some old code? Edited December 2, 2019 by MrTasty Link to comment
code123 Posted December 3, 2019 Author Share Posted December 3, 2019 I'm sure I saved it and etc. BTW The original code looks like that before I did changes function omg_movement() omg5036 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 90) omgMoveomg5036(1) omg9139 = createObject(8838, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 0) omgMoveomg9139(1) end function omgMoveomg5036(point) moveObject(omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg5036, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end function omgMoveomg9139(point) moveObject(omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) setTimer(moveObject, 5000, 0, omg9139, 5000, 2198.2998046875, 1214.2998046875, 13.5, 0, 0, 100) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omg_movement) And I tried modify it with that: addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function (new) if (new == "Running") then startomg_movement() end end) By removed that: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omg_movement) I don't know how to solve that. Should I use addEventHandler ? Link to comment
AleksCore Posted December 3, 2019 Share Posted December 3, 2019 (edited) @code123 maybe a dumb question, but remembering myself years and years before.. well, do you even have a function called "startomg_movement() " ? Also you can use for example outputChatBox to debug it and see where it fails, also check /debugscript We don't see your full code so it's hard to help. (I don't see). I have a feeling like instead of "startomg_movement()" there should be "omg_movement()" Oh, if its full code then ye, its obviously ur mistake Edited December 3, 2019 by AleksCore Link to comment
code123 Posted December 3, 2019 Author Share Posted December 3, 2019 Wow, I'm so stupid man XD, Thanks man, it works and, it was full code BTW, it is possible with clientside scripts ? 1 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