DRW Posted June 7, 2015 Share Posted June 7, 2015 (edited) addEventHandler ("onPlayerLogin", root, function(prev,cur) if isObjectInACLGroup ("user."..getAccountName(cur), aclGetGroup ( "Reg1" ) ) then setTimer (function(player) setElementHealth (player, getElementHealth (player)+2) end, 2000, 0,source) end end) addEventHandler ("onPlayerLogin", root, function(prev,cur) if isObjectInACLGroup ("user."..getAccountName(cur), aclGetGroup ( "Reg2" ) ) then setTimer (function(player) setPedArmor (player, getPedArmor (player)+2) end, 2000, 0,source) end end) Hello, I made this thing so people in an expected acl group could have health regen, the script works but it spams all the time this to the console: [2015-06-07 06:37:27] WARNING: zps\script.lua:15: Bad argument @ 'getElementHealth' [Expected element at argument 1] [2015-06-07 06:37:27] ERROR: zps\script.lua:15: attempt to perform arithmetic on a boolean value [2015-06-07 06:37:27] WARNING: zps\script.lua:24: Bad argument @ 'getPedArmor' [Expected ped at argument 1] [2015-06-07 06:37:27] ERROR: zps\script.lua:24: attempt to perform arithmetic on a boolean value What can I do? Edited June 8, 2015 by Guest Link to comment
DRW Posted June 7, 2015 Author Share Posted June 7, 2015 Use source instead. Now it works with armor, but look [2015-06-07 06:53:47] WARNING: zps\script.lua:15: Bad argument @ 'getElementHealth' [Expected element at argument 1, got nil] [2015-06-07 06:53:47] ERROR: zps\script.lua:15: attempt to perform arithmetic on a boolean value Link to comment
TAPL Posted June 7, 2015 Share Posted June 7, 2015 hTable = {} aTable = {} addEventHandler("onPlayerLogin", root, function(prev, cur) if isObjectInACLGroup ("user."..getAccountName(cur), aclGetGroup("Reg1")) then hTable[source] = setTimer(function(player) if isElement(player) then setElementHealth(player, getElementHealth(player)+2) else if isTimer(hTable[player]) then killTimer(hTable[player]) hTable[player] = nil end end end, 2000, 0, source) end if isObjectInACLGroup("user."..getAccountName(cur), aclGetGroup("Reg2")) then aTable[source] = setTimer(function(player) if isElement(player) then setPedArmor(player, getPedArmor(player)+2) else if isTimer(aTable[player]) then killTimer(aTable[player]) aTable[player] = nil end end end, 2000, 0, source) end end) Link to comment
DRW Posted June 8, 2015 Author Share Posted June 8, 2015 hTable = {} aTable = {} addEventHandler("onPlayerLogin", root, function(prev, cur) if isObjectInACLGroup ("user."..getAccountName(cur), aclGetGroup("Reg1")) then hTable[source] = setTimer(function(player) if isElement(player) then setElementHealth(player, getElementHealth(player)+2) else if isTimer(hTable[player]) then killTimer(hTable[player]) hTable[player] = nil end end end, 2000, 0, source) end if isObjectInACLGroup("user."..getAccountName(cur), aclGetGroup("Reg2")) then aTable[source] = setTimer(function(player) if isElement(player) then setPedArmor(player, getPedArmor(player)+2) else if isTimer(aTable[player]) then killTimer(aTable[player]) aTable[player] = nil end end end, 2000, 0, source) end end) Perfect, thanks!! Link to comment
#RooTs Posted June 8, 2015 Share Posted June 8, 2015 start to set vest when I already 100% or 200% health one can set this to me? please hTable = {} aTable = {} addEventHandler("onPlayerLogin", root, function(prev, cur) if isObjectInACLGroup ("user."..getAccountName(cur), aclGetGroup("Reg1")) then hTable[source] = setTimer(function(player) if isElement(player) then setElementHealth(player, getElementHealth(player)+2) else if isTimer(hTable[player]) then killTimer(hTable[player]) hTable[player] = nil end end end, 2000, 0, source) end if isObjectInACLGroup("user."..getAccountName(cur), aclGetGroup("Reg2")) then aTable[source] = setTimer(function(player) if isElement(player) then setPedArmor(player, getPedArmor(player)+2) else if isTimer(aTable[player]) then killTimer(aTable[player]) aTable[player] = nil end end end, 2000, 0, source) end end) 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