untrackable Posted May 15, 2011 Share Posted May 15, 2011 (edited) Look at this code: public class SecondScript : Script{ public SecondScript() { this.Wait(2000); Game.DisplayText("Its working"); } public void SirenOn() { this.Wait(3000); Game.DisplayText("Its not working :("); }}public class FirstScript : Script{ public void Siren() { SecordScript ss = new SecordScript(); ss.SirenOn(); }} Problem is with SirenOn method in SecondScript. When I create object from class SecondScript and call method SirenOn() (it's about Wait method inherited from Script) in this object GTA instantly freeze and I have to kill process. But 'Wait' is working when it's called from same object as it's in. Is any way to make it working? I mean calling Script methods in second object from first object. That problem is also with Interval method and Tick event. Edited May 15, 2011 by untrackable Link to comment Share on other sites More sharing options...
Donny78 Posted May 15, 2011 Share Posted May 15, 2011 There is no constructor for "FirstScript", the "Siren" method is never called, this will work: public class SecondScript : Script { public SecondScript() { this.Wait(2000); Game.DisplayText("Its working"); } public void SirenOn() { this.Wait(3000); Game.DisplayText("Its not working :("); } } public class FirstScript : Script { public FirstScript() // added constructor so the code is fired { SecondScript ss = new SecondScript(); // corrected typo here ss.SirenOn(); } } You may also want to switch the "Wait" to "Game.WaitInCurrentScript", I don't know what effect the normal Wait() will have on the script threads etc. Apart from this I don't really understand your question. Link to comment Share on other sites More sharing options...
untrackable Posted May 15, 2011 Author Share Posted May 15, 2011 (edited) You may also want to switch the "Wait" to "Game.WaitInCurrentScript", I don't know what effect the normal Wait() will have on the script threads etc. Ok. It's working. Edited May 16, 2011 by untrackable Link to comment Share on other sites More sharing options...
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