Jump to content

Problem with settings


MAB

Recommended Posts

Posted

i am trying to make a setting for a resource i made and that settings changes the number of the seconds that should pass so the the timer do a function... debugscript message : Error : server triggered clientside event receiveSettings, but event is not added clientside

meta :

     "Michael" type="script" name="" description="" /> 
     

server :

local FuelTimer = get"timer" 
triggerClientEvent("receiveSettings", root, FuelTimer) 

client :

local timer = 60 
  
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()) , 
    function () 
    addEvent("receiveSettings", true) 
    end) 
addEventHandler("receiveSettings", root, 
    function(arg) 
        timer = arg 
    end 
) 

Posted

why not just

client :

local timer = 60 
addEvent("receiveSettings", true) 
addEventHandler("receiveSettings", root, 
    function(arg) 
        timer = arg 
    end 
) 

and shouldnt:

     "images\f.png" /> 
     "images\s.png" /> 
     "images\e.png" /> 
     "images\n.png" /> 
     "images\h.png" /> 
     "images\d.png" /> 
     "images\c.png" /> 

be:

     "images/f.png" /> 
     "images/s.png" /> 
     "images/e.png" /> 
     "images/n.png" /> 
     "images/h.png" /> 
     "images/d.png" /> 
     "images/c.png" /> 

do those images actually load? :?

Posted

Yes, they do load. "/" "\" are the same thing in the meta.xml. I'm sure he has a reason not the put that variable inside the script. ie. he is going to compile the resource and make it public, but he wants to make it dynamic so that you can change the rate of something in the meta, which is not compiled and can be edited.

Posted
why not just

client :

local timer = 60 
addEvent("receiveSettings", true) 
addEventHandler("receiveSettings", root, 
    function(arg) 
        timer = arg 
    end 
) 

and shouldnt:

     "images\f.png" /> 
     "images\s.png" /> 
     "images\e.png" /> 
     "images\n.png" /> 
     "images\h.png" /> 
     "images\d.png" /> 
     "images\c.png" /> 

be:

     "images/f.png" /> 
     "images/s.png" /> 
     "images/e.png" /> 
     "images/n.png" /> 
     "images/h.png" /> 
     "images/d.png" /> 
     "images/c.png" /> 

do those images actually load? :?

hm.. i tried what are you talking about but didn't work

  • Scripting Moderators
Posted

I think that the error message shows when you are downloading resource. This means your client script doesn't start when server triggers client event.From your script,I found that the value of "timer" is defined as "number" but in your meta, "timer" is a string.

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