Spawn* Posted May 6, 2012 Posted May 6, 2012 Hello, I make a client-side script, but it doens't work. meta.xml: script: function cConnected() outputChatBox("* " .. getPlayerName(source) .. " Connected!") end addEventHandler("onClientPlayerJoin", getRootElement(), cConnected) Any other code placed in the script doesn't work too Help me please and sorry for my bad English
Kenix Posted May 6, 2012 Posted May 6, 2012 Your meta.xml wrong. Should be <meta> <script src="free_c.lua" type="client"/> </meta> You not add tags.
Spawn* Posted May 6, 2012 Author Posted May 6, 2012 My meta.xml is this: <meta> <script src="free_c.lua" type="client"/> <script src="free_s.lua" type="server"/> </meta> But don't work (the script free_s.lua work perfectly)
Spawn* Posted May 6, 2012 Author Posted May 6, 2012 I used this command, however, nothing more than "Your debug mode was set to 3" was displayed in the chat/game, and no error appears on the console. The script was executed, but no code works. Look again: function cConnected() outputChatBox("Executed!", source, 255, 0, 0, false) setWorldSpecialPropertyEnabled("hovecars", true) setCloudsEnabled(false) setTrafficLightState(9) setSunColor(255, 0, 0, 255, 0, 0) end addEventHandler("onClientPlayerJoin", getRootElement(), cConnected)
Guest Guest4401 Posted May 6, 2012 Posted May 6, 2012 Are you sure about onClientPlayerJoin? It's triggered when a player joins. It is triggered for all players except the local player, as the local player joins the server before their client-side resources are started. So if you joined the server, then you won't see the message which makes you think that the script isn't working. But it actually works.
Spawn* Posted May 6, 2012 Author Posted May 6, 2012 Yeah, but functions as setWorldSpecialPropertyEnabled, setTrafficLightState and setSunColor don't make any effect.
Guest Guest4401 Posted May 6, 2012 Posted May 6, 2012 Yeah, but functions as setWorldSpecialPropertyEnabled, setTrafficLightState and setSunColor don't make any effect. function cConnected() outputChatBox("Executed!",255, 0, 0, false) setWorldSpecialPropertyEnabled("hovecars", true) setCloudsEnabled(false) setTrafficLightState(9) setSunColor(255, 0, 0, 255, 0, 0) end addEventHandler("onClientResourceStart", resourceRoot, cConnected) Now it works.
Spawn* Posted May 6, 2012 Author Posted May 6, 2012 Oh, thank you very much! The message "Executed!" is displayed. But.... the others functions don't make any effect.
Guest Guest4401 Posted May 6, 2012 Posted May 6, 2012 Oh, thank you very much! The message "Executed!" is displayed. But.... the others functions don't make any effect. setWorldSpecialPropertyEnabled - Doesn't work because you mispelled 'hovercars' as 'hovecars' setCloudsEnabled - Works perfectly, It's disabling clouds setTrafficLightState - Works perfectly setSunColor - Works perfectly, it changed the sun color successfully. These are the results I get after testing.
Spawn* Posted May 6, 2012 Author Posted May 6, 2012 I fix the setWorldSpecialPropertyEnabled. But the sun is not red and the lights are lit.
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