Jump to content

client script the first time does not start


JustDance

Recommended Posts

Posted

Help me pls :) I have a problem. client script the first time does not start... If you exit and re-enter - it works. Why?

I trigger client script (function):

addEventHandler ( "onPlayerJoin", getRootElement(),  
function() 
    triggerClientEvent ( source, "selTeam", getRootElement(), source) 
end 
); 

eb95a6cbb9ee.jpg
Posted

Must be because the client doesn't has the files yet.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You probably did not understand me.... Its not client resource. Its client script.

core_s.lua:

addEventHandler ( "onPlayerJoin", getRootElement(),  
function() 
    triggerClientEvent ( source, "selTeam", getRootElement(), source) 
end 
); 

core_c.lua:

function sel_team(source) 
    for i = 1,20 do outputChatBox(" ") end 
    outputChatBox('lol') 
    fadeCamera(true) 
end 
addEvent("selTeam", true) 
addEventHandler("selTeam", getRootElement(), sel_team) 

meta:

<meta> 
     <script src="core_s.lua" type="server" /> 
     <script src="core_client.lua" type="client" /> 
     <file src="teams.xml" /> 
</meta> 

eb95a6cbb9ee.jpg
Posted

why you need a trigger for that? it's not needed, you can do it server side too.

addEventHandler ( "onPlayerJoin", getRootElement(), 
function() 
    for i = 1,20 do outputChatBox(" ",source) end 
    outputChatBox('lol',source) 
    fadeCamera(source,true) 
   end 
end 
); 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

I know... But this is not the original... I need use client functions! this is just an example. source I do not want to share:)

Edited by Guest
eb95a6cbb9ee.jpg
Posted

Then, why you need to trigger to client if you are using client functions? i don't see much point, you should use onClientResourceStart

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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