Jump to content

[QUESTION] Does 'onResourceStart' cover 'onClientResourceStart' ?


koragg

Recommended Posts

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 by Saml1er
  • Like 1
Link to comment

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.

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...