Jump to content

What s problem


Scripting

Recommended Posts

tiggerClientEvent don t work!

server-side:

addEventHandler("onResourceStart",root, 
function () 
     triggerClientEvent ( 'startTheClient',source ) 
end 
) 

Exactly what are you trying to do here?

When you use 'onResourceStart' the source of that event is the resource that started. So you can't triggerClientEvent for players if thats what you are trying to do.

"The source of this event is the root element in the resource that started."

From: https://wiki.multitheftauto.com/wiki/OnResourceStart

If you want to trigger a clientEvnet for all players when the resource starts, do could do:

  
addEventHandler("onResourceStart",root, 
function () 
     
    for i,player in ipairs( getElementsByType( "player" ) ) do 
     
        triggerClientEvent ( player, 'startTheClient', player ) 
     
    end 
end) 
  

You should also take a look at: https://wiki.multitheftauto.com/wiki/OnC ... ourceStart

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...