Link2012 Posted December 8, 2012 Posted December 8, 2012 he, what's the difference between doing: doStuff() doMoreStuff() and addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()) , function(res) doStuff() doMoreStuff() end ); I can't see the point...
NodZen Posted December 8, 2012 Posted December 8, 2012 I do not understand what you mean. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Tete omar Posted December 8, 2012 Posted December 8, 2012 doStuff() doMoreStuff() is a functions that happens when the resource start just like function doStuff() outputChatBox("Resouce started") end function doMoreStuff() outputChatBox("Welcome to this server!") end that was an example;)
Link2012 Posted December 8, 2012 Author Posted December 8, 2012 You didn't understand, really (I expected I didn't had to say that doStuff and doMoreStuff are pseudo-funcs) What I mean is, what's the difference between putting my functions\commands\whatever_I_Want_To_Do in onClientResourceStart and on the "main part" of the lua file, since the "main part" of the lua file has started, it means that the resource started, right?
NodZen Posted December 8, 2012 Posted December 8, 2012 I think there is no difference. i'm not secure. ------------------------------------------------------------------------------------------ My scripts http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977 http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740
Tete omar Posted December 8, 2012 Posted December 8, 2012 You didn't understand, really (I expected I didn't had to say that doStuff and doMoreStuff are pseudo-funcs)What I mean is, what's the difference between putting my functions\commands\whatever_I_Want_To_Do in onClientResourceStart and on the "main part" of the lua file, since the "main part" of the lua file has started, it means that the resource started, right? yes , event 'onClientResourceStart' is triggered when the resource starts to run and these 2 functions will be happened when the resource starts ..
Link2012 Posted December 8, 2012 Author Posted December 8, 2012 So the answer is: there's no difference?
Castillo Posted December 8, 2012 Posted December 8, 2012 I'm not exactly sure of it's difference, but some times if you don't use it, some scripts may have not work, not all of them. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
50p Posted December 8, 2012 Posted December 8, 2012 I explained it long time ago, viewtopic.php?f=91&t=23895&p=289200#p289183 In addition, if you want the script to work properly use events. If you don't and the script doesn't work then ask yourself why and remind yourself I suggested to use events. The difference is that on(Client)ResourceStart get triggered only when all the scripts within the resource get executed. If you're calling a function from a different file and that file hasn't started yet then your script will fail because it doesn't know about existence of that function. This is why you should use the event to be safe. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
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