• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

help me fix the error use tfs 1.2 8.0 downgrage

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,145
Solutions
56
Reaction score
521
Location
ლ(ಠ益ಠლ)

Lua:
local Speed = createConditionObject(CONDITION_HASTE)
local Muted = createConditionObject(CONDITION_MUTED)
local Metabolism = createConditionObject(CONDITION_ATTRIBUTES)
local Light = createConditionObject(CONDITION_LIGHT)

setConditionParam(Speed, CONDITION_PARAM_TICKS, 30000)
setConditionFormula(Speed, 100, 1, 1000, 1)
setConditionParam(Light, CONDITION_PARAM_TICKS, 30000)
setConditionParam(Light, CONDITION_PARAM_LIGHT_COLOR, 1)
setConditionParam(Light, CONDITION_PARAM_LIGHT_LEVEL, 1)
setConditionParam(Metabolism, CONDITION_PARAM_TICKS, 30000)
setConditionParam(Metabolism, CONDITION_PARAM_HEALTHGAIN, 40)
setConditionParam(Metabolism, CONDITION_PARAM_MANATICKS, 1)
setConditionParam(Metabolism, CONDITION_PARAM_MANAGAIN, 40)
setConditionParam(Metabolism, CONDITION_PARAM_HEALTHTICKS, 1)

function onUse(cid, item, frompos, item2, topos)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_INVISIBLE)
local config = {storages = {st0 = 65528 ,st1 = 65535, st2 = 65534, st3 = 65533, st4 = 65532, st5 = 65531, st6 = 65530, st7 = 65529}, --Tem que ser a mesma da magia.lua
soul = 50,
mp = 20, ---Porcentagem Mana---
hp = 25, ---Porcentagem Health ---
duration = 30, ---Segundos---
intervalo = 2, ---Intervalo das healada---
magic = 65, --- magic effect que manda---
outfits = {
[1] = {app = Speed,
text = 'BlooD!',
name = "Hazus",
lookAddon = 0,
lookType = 262,
lookHead = getCreatureOutfit(cid).lookHead,
lookTypeEx = 0,
lookLegs = getCreatureOutfit(cid).lookLegs,
lookBody = getCreatureOutfit(cid).lookBody,
lookFeet = getCreatureOutfit(cid).lookFeet,
},
[2] = {app = Muted,
text = 'BlooD!',
name = "Kazard",
lookAddon = 3,
lookType = 194,
lookHead = getCreatureOutfit(cid).lookHead,
lookTypeEx = 0,
lookLegs = getCreatureOutfit(cid).lookLegs,
lookBody = getCreatureOutfit(cid).lookBody,
lookFeet = getCreatureOutfit(cid).lookFeet,
},
[3] = {app = Metabolism,
text = 'BlooD!',
name = "Chronos",
lookAddons = 3,
lookType = 251,
lookHead = getCreatureOutfit(cid).lookHead,
lookTypeEx = 0,
lookLegs = getCreatureOutfit(cid).lookLegs,
lookBody = getCreatureOutfit(cid).lookBody,
lookFeet = getCreatureOutfit(cid).lookFeet,
},
[4] = {app = Light,
text = 'oi',
name = "Royalty",
lookAddon = 0,
lookType = 309,
lookHead = 114,
lookTypeEx = 0,
lookLegs = 114,
lookBody = 114,
lookFeet = 114,
},
},
}
local s = math.random(1,3)
local outfit_use = config.outfits[s]
local outfit_text_sorted = outfit_use.text
table.remove(outfit_use, text)
if getPlayerSoul(cid) >= config.soul then
if getPlayerStorageValue(cid, config.storages.st7) == -1 then
doPlayerAddSoul(cid, (config.soul * (-1)))
local er = (config.duration / config.intervalo)
function heal(cid)
if isPlayer(cid) then
doCreatureAddHealth(cid, (doPlayerAddMana(cid) * (config.hp / 100)))
doPlayerAddMana(cid, (doPlayerAddMana(cid) * (config.mp / 100)))
doSendAnimatedText(getCreaturePosition(cid), outfit_text_sorted, 20)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_INVISIBLE)
doSendMagicEffect(getCreaturePosition(cid), config.magic)
if er >= 1 then
addEvent(heal, (config.intervalo * 1000), cid)
end
er = er - 1
end
end
local player_outfit_magia = getCreatureOutfit(cid)
getPlayerStorageValue(cid, config.storages.st0, player_outfit_magia.lookAddons)
getPlayerStorageValue(cid, config.storages.st1, player_outfit_magia.lookType)
getPlayerStorageValue(cid, config.storages.st2, player_outfit_magia.lookHead)
getPlayerStorageValue(cid, config.storages.st3, player_outfit_magia.lookTypeEx)
getPlayerStorageValue(cid, config.storages.st4, player_outfit_magia.lookLegs)
getPlayerStorageValue(cid, config.storages.st5, player_outfit_magia.lookBody)
getPlayerStorageValue(cid, config.storages.st6, player_outfit_magia.lookFeet)
doCreatureSay(cid, "Grr "..outfit_use.name.." is back!", TALKTYPE_ORANGE_1)
doRemoveItem(item.uid,1)
doPlayerSendTextMessage(cid,20, "Seu corpo entrou em renegeração por ("..config.duration..") segundos.")
er = er - 1
getPlayerStorageValue(cid, config.storages.st7, 1)
function outfit(cid)
if isPlayer(cid) then
doCreatureChangeOutfit(cid, player_outfit_magia)
player:getPlayerStorageValue(cid, config.storages.st7, -1)
end
end
doAddCondition(cid, outfit_use.app)
table.remove(outfit_use, app)
table.remove(outfit_use, hability)
doCreatureChangeOutfit(cid, outfit_use)
doCreatureAddHealth(cid, config.hp)
doPlayerAddMana(cid, config.mp)
doSendMagicEffect(getCreaturePosition(cid), config.magic)
heal(cid)
addEvent(outfit, (((config.duration) * 1000) + 2), cid)
else
doPlayerSendTextMessage(cid, 18, 'Você não pode ativar outro blood of god\'s enquanto estiver em efeito de um.')
doSendMagicEffect(frompos, 2)
end
else
doPlayerSendTextMessage(cid, 18, 'Desculpe, você não tem souls suficiente.')
doSendMagicEffect(getCreaturePosition(cid), 2)
end
return true
end
 
Source of your issue:
Lua:
doCreatureAddHealth(cid, (doPlayerAddMana(cid) * (config.hp / 100)))
doPlayerAddMana(cid, (doPlayerAddMana(cid) * (config.mp / 100)))

I guess you wanted something like:
Lua:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) * (config.hp / 100))
doPlayerAddMana(cid, getPlayerMaxMana(cid) * (config.mp / 100))
 
this function is working ok, but there is another error see
Source of your issue:
Lua:
doCreatureAddHealth(cid, (doPlayerAddMana(cid) * (config.hp / 100)))
doPlayerAddMana(cid, (doPlayerAddMana(cid) * (config.mp / 100)))

I guess you wanted something like:
Lua:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) * (config.hp / 100))
doPlayerAddMana(cid, getPlayerMaxMana(cid) * (config.mp / 100))


 
Yea you're mixing legacy API with new one, but anyway cid(first param) is actualy a creature object so you need to rework the script to pass creature ID into addEvent.
Easiest fix would probably be to do it like that:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid = player:getId()
    ...
    ...
end

Note that param names are also different in provided example (e.g. frompos to fromPosition)
 
Yea you're mixing legacy API with new one, but anyway cid(first param) is actualy a creature object so you need to rework the script to pass creature ID into addEvent.
Easiest fix would probably be to do it like that:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local cid = player:getId()
    ...
    ...
end

Note that param names are also different in provided example (e.g. frompos to fromPosition)
sorry, my head is confused from this script... could you show me where i should correct?
 
Back
Top