Zie[E]D_)"U.R Posted July 4, 2017 Share Posted July 4, 2017 Hello guys i will try to go straight to the point this is a health regeneration over time script (this is not mine , full credit goes to the maker) setTimer( function () setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) end,5000,0) function autor() outputChatBox("health regen", source, 0, 255, 255, true) end addEventHandler("onClientPlayerJoin", getRootElement(), autor) i want this lua cript to be operational for "VIP" group (for example) only . means , only players with VIP can have their health regenerated . what should i add to make it that way ? thank you . these are some things i tried for myself . (but didn't work) in acl.xml under group VIP <object name="resource.healthregeneration"></object> under acl VIP access="true"></right> <right name="resource.healthregeneration" under all Acls access="false"></right> <right name="resource.healthregeneration" Link to comment
kikos500 Posted July 4, 2017 Share Posted July 4, 2017 (edited) function regen() for i,v in pairs(getElementsByType("player")) do if isObjectInACLGroup( "user."..getPlayerName(v), aclGetGroup("VIP")) then setElementHealth (v, getElementHealth (v) + 15) end end end setTimer(regen, 5000, 0) function Join() outputChatBox("health regen", source, 0, 255, 255, true) end addEventHandler("onClientPlayerJoin", getRootElement(), Join) didn't test it use it server side not client Edited July 4, 2017 by kikos500 Link to comment
koragg Posted July 4, 2017 Share Posted July 4, 2017 At line 3 it should be getAccountName (getPlayerAccount (v)) instead of getPlayerName (v) Link to comment
Zie[E]D_)"U.R Posted July 4, 2017 Author Share Posted July 4, 2017 it didn't work guys any alternative solutions Link to comment
N98E Posted July 4, 2017 Share Posted July 4, 2017 (edited) function healthRegen() for i,v in pairs(getElementsByType("player")) do if isObjectInACLGroup( "user."..getAccountName(getPlayerAccount(v)), aclGetGroup("VIP")) then setElementHealth (v, getElementHealth (v) + 15) end end end setTimer(healthRegen, 5000, 0) function clientJoin() outputChatBox("health regen", source, 0, 255, 255, true) end addEventHandler("onClientPlayerJoin", getRootElement(), clientJoin) Edited July 4, 2017 by N98E Link to comment
Rose Posted July 4, 2017 Share Posted July 4, 2017 This code works, function Loin() if isObjectInACLGroup( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup("VIP") ) then setTimer( regen, 50, 0, source ) outputChatBox("Health regen", source, 0, 255, 255, true) end end addEventHandler("onPlayerLogin", getRootElement(), Loin) function regen( player ) setElementHealth ( player, getElementHealth ( player ) + 15 ) end Link to comment
Zie[E]D_)"U.R Posted July 4, 2017 Author Share Posted July 4, 2017 none of them works .. im sure they are right , but i think something is missing in the resource file ? this is my meta file , is something wrong in it ? <meta> <info author="TimmY14" version="1.0.0" type="script" name="healthregeneration" description="hp regen" /> <script src="health.lua" type="server" /> </meta> Link to comment
koragg Posted July 4, 2017 Share Posted July 4, 2017 1 hour ago, Zie[E]D_)"U.R said: none of them works .. im sure they are right , but i think something is missing in the resource file ? this is my meta file , is something wrong in it ? <meta> <info author="TimmY14" version="1.0.0" type="script" name="healthregeneration" description="hp regen" /> <script src="health.lua" type="server" /> </meta> All looks fine. You sure the group is "VIP" and not "ViP" or something? Link to comment
Zie[E]D_)"U.R Posted July 4, 2017 Author Share Posted July 4, 2017 (edited) everything looks fine ! maybe the scripts are wrong (remember , it is a vip only resource and +15 health every 5 seconds) this is what i have done so far : acl.xml <group name="VIP"> <acl name="VIP"></acl> <object name="user.ziedur"></object> health.lua ( i tried Rose , N98E and kokos500 with the fixed getplayerName ) For Rose's script when i logged in with my VIP accounts i got the output health regen in my chat box but no health is generated for kokos500 : meta.xml <meta> <info author="TimmY14" version="1.0.0" type="script" name="healthregeneration" description="hp regen" /> <script src="health.lua" type="server" /> </meta> Edited July 4, 2017 by Zie[E]D_)"U.R 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