Jump to content

Client-side Resource doens't work!


Recommended Posts

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 :mrgreen:

Link to comment

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) 

:cry:

Link to comment
Guest Guest4401

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.

Link to comment
Guest Guest4401
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.

Link to comment
Guest Guest4401
Oh, thank you very much! The message "Executed!" is displayed. But.... the others functions don't make any effect. :cry:

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.

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