LiOneLMeSsIShoT Posted July 16, 2013 Share Posted July 16, 2013 I made this script to make the player Lay and set his health +5 every 4 seconds...but i got an error..please help Server: function setHealth (theplayer) local Ganim = getPedAnimation (theplayer, Lay_Bac_Loop) local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) ERROR Line: ERROR: Health\Health.lua:3: attempt to call global 'getPedAnimation' (a nil value) Please help me guys ... and THANKS alot Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 try this now function setHealth (theplayer) local Ganim = getPedAnimation (theplayer, "Lay_Bac_Loop") local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 try this now function setHealth (theplayer) local Ganim = getPedAnimation (theplayer, "Lay_Bac_Loop") local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Okay gonna try and tell you Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 try this now function setHealth (theplayer) local Ganim = getPedAnimation (theplayer, "Lay_Bac_Loop") local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Okay gonna try and tell you Da same ERROR ERROR: Health\Health.lua:3: attempt to call global 'getPedAnimation' (a nil value) Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 my bad: try this function setHealth (theplayer) local Ganim = getPedAnimation (theplayer) local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 my bad:try this function setHealth (theplayer) local Ganim = getPedAnimation (theplayer) local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Gonna try Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 my bad:try this function setHealth (theplayer) local Ganim = getPedAnimation (theplayer) local health = getElementHealth(theplayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) Gonna try The same Problem man Check it again....also i feel like there's a problem with SetTimer because i just wanted the health up every 4 sec so i puted this Timer ...fix it if you can..And THANKS ALOT! Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 The timer is make no senses while you are putting it out of the command handler Is it the same errors? Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 Also replace local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") with local daAnim = getElementData(theplayer, "animz") local daBlockz = getElementData(theplayer, "blockz") Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 Also replace local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") with local daAnim = getElementData(theplayer, "animz") local daBlockz = getElementData(theplayer, "blockz") function setHealth (theplayer) local daAnim = getElementData(theplayer, "animz") local daBlockz = getElementData(theplayer, "blockz") local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) ERRORS! Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Warrning: :11: Bad argument @ 'setPedAnimation' Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 I said replace no't add Ops..Mistake man Gonna try Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 Also replace local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") with local daAnim = getElementData(theplayer, "animz") local daBlockz = getElementData(theplayer, "blockz") script: function setHealth (theplayer) local Ganim = getPedAnimation (theplayer) local health = getElementHealth(theplayer) local daAnim = getElementData(theplayer, "animz") local daBlockz = getElementData(theplayer, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(theplayer,false) else setPedAnimation (theplayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( player, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) ERROR: attempt to call global 'getPedAnimation' ( a nil value) Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 (edited) replace setElementHealth ( player, health +5) with setElementHealth ( theplayer, health +5) I'm sorry but i thought you make i marker hit If it's command the player most be source Edited July 16, 2013 by Guest Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 replace setElementHealth ( player, health +5) with setElementHealth ( theplayer, health +5) The Same ERROR in : 3 : Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 I'm sorry but i thought you make a marker hit If it's command the player most be source Link to comment
LiOneLMeSsIShoT Posted July 16, 2013 Author Share Posted July 16, 2013 I'm sorry but i thought you make a marker hit If it's command the player most be source Man i want to make it more good..like he can add HP everywere...by Command...if you can't help me with it..there's no problemo man Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 try -- Client Side function setHealth ( ) local Ganim = getPedAnimation (localPlayer) local health = getElementHealth(localPlayer) local daAnim = getElementData(root, "animz") local daBlockz = getElementData(root, "blockz") if daBlockz == "Laying" and daAnimz == "Lay_Bac_Loop" then setPedAnimation(localPlayer,false) else setPedAnimation (localPlayer, "LAYING", "Lay_Bac_Loop") end if Ganim then setElementHealth ( localPlayer, health +5) end end setTimer(setHealth, 4000, 1) addCommandHandler ("relax", setHealth) some Mistakes Solved. cheak for the Example 2 Client side https://wiki.multitheftauto.com/wiki/SetPedAnimation look at setElementData 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