Jump to content

Resource starts 2 times


Recommended Posts

2pyrkva.jpg

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 by Guest
Link to comment
WOw. I understand now :D

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

Link to comment

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.

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