Hello all.. Just want to ask, is that I write will work as I want to?
first one - I wanted to do a nutrition for facc and pacc, so pacc could eat twice more and it will last twice longer
second one - Light difference between pacc and facc.
Pacc users will get a more light than facc players (-1 is "fading light, not infinity" thats why I put that count for pacc, and -1 as fading efect for facc)
maybe some one got any better idea, fix for that one I got here?
but i wonder - if that food one will work
im beginer - so please be gentle... its some of my first time
first one - I wanted to do a nutrition for facc and pacc, so pacc could eat twice more and it will last twice longer
Lua:
function onUse(player, item, fromPosition, target, toPosition)
local itemType = ItemType(item:getId())
local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
if condition and not player:isPremium() and math.floor(condition:getTicks() / 1000 + (itemType:getNutrition() * 12)) >= 1200 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are full facc.")
elseif condition and player:isPremium() and math.floor(condition:getTicks() / 2000 + (itemType:getNutrition() * 12)) >= 2400 then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are full pacc.")
else
player:feed(itemType:getNutrition() * 12)
item:remove(1)
end
return true
end
second one - Light difference between pacc and facc.
Pacc users will get a more light than facc players (-1 is "fading light, not infinity" thats why I put that count for pacc, and -1 as fading efect for facc)
Lua:
pacc_light = createConditionObject(CONDITION_LIGHT)
setConditionParam(pacc_light, CONDITION_PARAM_TICKS, (24 * 60 * 60) * 1000)
setConditionParam(pacc_light, CONDITION_PARAM_LIGHT_LEVEL, 5)
setConditionParam(pacc_light, CONDITION_PARAM_LIGHT_COLOR, 215)
setConditionParam(pacc_light, CONDITION_PARAM_SUBID, 90)
pacc_light_off = createConditionObject(CONDITION_LIGHT)
setConditionParam(pacc_light_off, CONDITION_PARAM_TICKS, -1)
setConditionParam(pacc_light_off, CONDITION_PARAM_LIGHT_LEVEL, 1)
setConditionParam(pacc_light_off, CONDITION_PARAM_LIGHT_COLOR, 215)
setConditionParam(pacc_light_off, CONDITION_PARAM_SUBID, 91)
function onLogin(player)
...blah blah blah, some onlogin lua s*hit...
if not player:isPremium() then
loginStr4 = string.format("Account status: Free account")
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, loginStr4)
player:addCondition(pacc_light_off)
end
if player:isPremium() then
loginStr4 = string.format("Account status: Premium account")
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, loginStr4)
player:addCondition(pacc_light)
end
maybe some one got any better idea, fix for that one I got here?
but i wonder - if that food one will work
im beginer - so please be gentle... its some of my first time