#Humber* Posted June 28, 2016 Posted June 28, 2016 Hi all, well, I want something like this... theTimer = setTimer(setWaterLevel, 100, 0, getWaterLevel()+0.1) But I can't use getWaterLevel() on server-side. I know how to use triggerClientEvent() but not for this. Help please.
Bean666 Posted June 28, 2016 Posted June 28, 2016 why not keep them on client side then, setWaterLevel is shared.
#Humber* Posted June 28, 2016 Author Posted June 28, 2016 Yes, I tried it, but I must use: isObjectInACLGroup()
Bean666 Posted June 28, 2016 Posted June 28, 2016 use triggerClientEvent, use this kind of function TheTimer = setTimer( function() -- your stuff-- end, 1000, 0) setTimer of triggerclient event example which you could add in that function setTimer(triggerClientEvent, 1000, 0, element, "event", element) 1: means once only 0: means endless
#Humber* Posted June 28, 2016 Author Posted June 28, 2016 I know how to use triggerClientEvent() but not for this. Can you give me an example, please?
Bean666 Posted June 28, 2016 Posted June 28, 2016 make an event that adds +0.1 each second then use triggerClientEvent
#Humber* Posted June 28, 2016 Author Posted June 28, 2016 Good idea. I will try. But, can I use this? client function setWL() theTimer = setTimer(setWaterLevel, 100, 0, getWaterLevel()+0.1) end addEvent("setWaterL") addEventHandler("setWaterL", root, setWL) server addCommandHandler("tsunami", function(source) local sourceAccount = getPlayerAccount(source) if isObjectInACLGroup("user."..getAccountName(sourceAccount), aclGetGroup("Admin")) then triggerClientEvent(source, "setWaterL") end end )
Bean666 Posted June 28, 2016 Posted June 28, 2016 (edited) i don't see anything wrong but i think yeah give it a try! if there is something wrong tell me whats wrong. better if u mix getplayeracc and get account name. addCommandHandler("tsunami", function(source) local sourceAccount = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup("user."..sourceAccount, aclGetGroup("Admin")) then triggerClientEvent(source, "setWaterL", source) end end ) Edited June 28, 2016 by Guest
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