Jump to content

Client-side Resource doens't work!


Recommended Posts

Posted

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:

Guest Guest4401
Posted
>    ="free_c.lua" type="client"/>>

Posted

Your meta.xml wrong.

Should be

  
<meta> 
 <script src="free_c.lua" type="client"/> 
</meta> 

You not add tags.

Posted

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 :cry: (the script free_s.lua work perfectly) :cry:

Posted

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:

Guest Guest4401
Posted

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.

Posted

Yeah, but functions as setWorldSpecialPropertyEnabled, setTrafficLightState and setSunColor don't make any effect.

Guest Guest4401
Posted
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.

Posted

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

Guest Guest4401
Posted
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.

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