heroes9898 Posted May 26, 2014 Posted May 26, 2014 (edited) there is two times "INFO: ==== RESOURCE STARTED! ====" i wrote into onResourceStart "outputDebugString( ==== RESOURCE STARTED! ====)" and i see now its starts two times. The resource spawns vehicles 2 TIMES in same position!! But this problem happens when I start the server, not the resource. When i restart the resource, then starts normally. Edited May 29, 2014 by Guest
Castillo Posted May 26, 2014 Posted May 26, 2014 Make sure the event handler is attached to the resource root element, and not to root.
heroes9898 Posted May 27, 2014 Author Posted May 27, 2014 WTF!!!! Thank you so much. Fixed. And should every event handler have that resource root element? or only the onResourceStart's ? And client events too? So where should I use that resource root element, not root?
heroes9898 Posted May 27, 2014 Author Posted May 27, 2014 WOw. I understand now I should use in ResourceStarts always getresourceRoot... and in other event handlers always the resourceroot , not it? But when should I use "root" ??
xXMADEXx Posted May 27, 2014 Posted May 27, 2014 WOw. I understand now I should use in ResourceStarts always getresourceRoot... and in other event handlers always the resourceroot , not it? But when should I use "root" ?? root is a variable for getRootElement. You would use this, well, in the case of make a server welcome message. Example: addEventHandler ( "onPlayerJoin", root --[[For all of the players]] , function ( ) outputChatBox ( "Welcome to the server!", source, 255, 255, 255 ) -- Output text to the player who just joined. end ) Try reading this to: viewtopic.php?f=91&t=39678
MTA Team qaisjp Posted May 28, 2014 MTA Team Posted May 28, 2014 also please dont put "important", it may be important for you but not anyone else
Castillo Posted May 28, 2014 Posted May 28, 2014 WOw. I understand now I should use in ResourceStarts always getresourceRoot... and in other event handlers always the resourceroot , not it? But when should I use "root" ?? You can make it shorter by using "resourceRoot".
MTA Team qaisjp Posted May 29, 2014 MTA Team Posted May 29, 2014 by the way, heroes. the second argument limits the source argument. in this case the source argument is the resource that started. "root" means every element, so the event is triggered every time any resource starts. changing the second arg to resourceRoot limits the source argument to resourceRoot, (resource root element), so that only that source can trigger it.
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