Turbe$Z Posted March 13, 2017 Posted March 13, 2017 function autostat(thePlayer) setPlayerStat(thePlayer, 24, 1000) setElementHealth(thePlayer, 255) end addEventHandler("onResourceStart", resourceRoot, autostat) i got this warnings: [22:09:28] WARNING: autostat\autostat.lua:2: Bad argument @ 'setPlayerStat' [Expected element at argument 1, got resource-data] [22:09:34] WARNING: autostat\autostat.lua:3: Bad argument @ 'setElementHealth' [Expected element at argument 1, got resource-data]
LoPollo Posted March 13, 2017 Posted March 13, 2017 onResourceStart When a resource starts, the handler of that start will pass the passed resource as first parameter. There's no player to work with. You may want to loop all players and set the stats. Note that setPlayerStat is deprecated. Regarding setElementHealth, just to make sure you know: it will set the current HP, not the "stat" of health. Looking at the 2nd example of setPedStat can help you dealing with health values depending on variable max health stat.
_DrXenon Posted March 13, 2017 Posted March 13, 2017 (edited) function autostat() for i,v in ipairs(getElementsByType("player")) do setPedStat(v,24,1000) setElementHealth(v,255) end end addEventHandler("onResourceStart",resourceRoot,autostat) that should probably work as u wish Edited March 13, 2017 by SuperCroz 1
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