koragg Posted July 20, 2017 Share Posted July 20, 2017 Pretty much what the title says. If i use 'onResourceStart' server side does that mean that when a player joins late the function will get initiated for him? Link to comment
Saml1er Posted July 20, 2017 Share Posted July 20, 2017 (edited) onResourceStart is a server-side event that is triggered when a resource starts. It has nothing to do with a player joining a server. If you want to execute some code when a player joins your server then you should use onPlayerJoin for server-side and onClientPlayerJoin for client-side. On the other hand, onClientResourceStart is a client-side event that is triggered when a client-side script starts. You can have multiple scripts that should run on client side and this event will be called separately for each script. Once again, it has nothing to do with a player joining a server. The name of the event is misleading, onClientScriptStart (Not an event, just my opinion) would have made more sense but since the name of the event is hardcoded in most scripts so it's not an option to change it now. MTA WIKI: This event is triggered when a resource is started. Please note that this is not triggered the same time as the serverside event onResourceStart is. The event is triggered when any clientside resources are started. This means it is triggered when a clientside script is initiated after a download, which includes downloading after join. So: If a resource is running before a player joins, the onClientResourceStart event will be triggered after they join and have downloaded that resource. If a resource is started after a player has joined, the player will be made to download the required files, and then the onClientResourceStart event will be triggered. Edited July 20, 2017 by Saml1er 1 Link to comment
Simple0x47 Posted July 20, 2017 Share Posted July 20, 2017 onResourceStart doesnt cover entirely onClientResource but the other way yes. Because onClientResourceStart gets triggered whenever the resource starts for the client ( join and start ). Meanwhile server just starts when its triggered on the server. Answering to your question no. 1 Link to comment
koragg Posted July 20, 2017 Author Share Posted July 20, 2017 Thanks guys, I had an idea about something and wasn't sure if it would work. Now I know it wouldn't have but I managed to do it another way 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