#Humber* Posted June 28, 2016 Share 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. Link to comment
Bean666 Posted June 28, 2016 Share Posted June 28, 2016 why not keep them on client side then, setWaterLevel is shared. Link to comment
#Humber* Posted June 28, 2016 Author Share Posted June 28, 2016 Yes, I tried it, but I must use: isObjectInACLGroup() Link to comment
Bean666 Posted June 28, 2016 Share 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 Link to comment
#Humber* Posted June 28, 2016 Author Share Posted June 28, 2016 I know how to use triggerClientEvent() but not for this. Can you give me an example, please? Link to comment
#Humber* Posted June 28, 2016 Author Share Posted June 28, 2016 Oh wait, I have an idea Link to comment
Bean666 Posted June 28, 2016 Share Posted June 28, 2016 make an event that adds +0.1 each second then use triggerClientEvent Link to comment
#Humber* Posted June 28, 2016 Author Share 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 ) Link to comment
Bean666 Posted June 28, 2016 Share 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 Link to comment
#Humber* Posted June 28, 2016 Author Share Posted June 28, 2016 Okay, thank you so much. Link to comment
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