JustDance Posted February 5, 2011 Share Posted February 5, 2011 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 ); Link to comment
Castillo Posted February 5, 2011 Share Posted February 5, 2011 Must be because the client doesn't has the files yet. Link to comment
SDK Posted February 5, 2011 Share Posted February 5, 2011 To make sure the client resource is start, use onClientResourceStart instead of onPlayerJoin Link to comment
JustDance Posted February 5, 2011 Author Share Posted February 5, 2011 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> Link to comment
Castillo Posted February 5, 2011 Share Posted February 5, 2011 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 ); Link to comment
JustDance Posted February 5, 2011 Author Share Posted February 5, 2011 (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 February 5, 2011 by Guest Link to comment
Castillo Posted February 5, 2011 Share Posted February 5, 2011 Then, why you need to trigger to client if you are using client functions? i don't see much point, you should use onClientResourceStart Link to comment
JustDance Posted February 5, 2011 Author Share Posted February 5, 2011 You can see this: 178.94.4.121:22003 pass: 123456 oh, thanx man. It work witch onClientResourceStart 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