• 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!

Lua tfs 1.2 help Script actions

abdala ragab

Veteran OT User
Joined
Aug 18, 2018
Messages
447
Solutions
11
Reaction score
331
Location
gamelaot.sytes.net
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
local level = getPlayerLevel(cid)
     if getPlayerStorageValue(cid,90733) < 3 then
        if getPlayerLevel(cid) > 1 then
           setPlayerStorageValue(cid,90733,3)
                  doPlayerSay(cid, "Felicity " ..  name .. " [" ..level.. "], Cast Your New Spell.", TALKTYPE_ORANGE_1)
                  doRemoveItem(item.uid, 1)
        else
            doPlayerSendTextMessage(cid,19,"You " ..  name .. " [" ..level.. "], need to be Level 100 or More To Use It.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
else
            doPlayerSendTextMessage(cid,19,"Sorry " ..  name .. " [" ..level.. "], You Have Done The Q Before.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end   
return TRUE
end


Lua Script Error: [Action Interface]
data/actions/scripts/Mana Max.lua:eek:nUse
data/actions/scripts/Mana Max.lua:7: attempt to call global 'doPlayerSay' (a nil
value)
 
Solution
Lua:
 local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 55)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(player, var)
  player:addMana(320)
        player:say("[Low Mana]", TALKTYPE_MONSTER_SAY)
    return doCombat(player, combat, var)
end
This works. Look at it. Maybe you can help me
Idk nothing about the New functions, but, i will try.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     if player:getStorageValue(90733) < 3 then
        if player:getLevel() > 1 then
           player:setStorageValue(90733, 3)...
Change
Lua:
doPlayerSay(cid, "Felicity " .. name .. " [" ..level.. "], Cast Your New Spell.", TALKTYPE_ORANGE_1)

To
Lua:
doPlayerSay(cid, "Felicity "..  name .." [".. level .."], Cast Your New Spell.", TALKTYPE_ORANGE_1)
 
So, i think doPlayerSay doesnt exist in your server, check another script to see how they call this function maybe player:say, check your potions.lua in actions
Lua:
 local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 55)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(player, var)
  player:addMana(320)
        player:say("[Low Mana]", TALKTYPE_MONSTER_SAY)
    return doCombat(player, combat, var)
end
This works. Look at it. Maybe you can help me
 
when i use get this msg >01:20 Sorry Abdala Ragab [661], You Have Done The Q Before.
I can use it more than once
look script and help Bro
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
local level = getPlayerLevel(cid)
     if getPlayerStorageValue(cid,90733) < 3 then
        if getPlayerLevel(cid) > 1 then
           setPlayerStorageValue(cid,90733,3)
                  player:say("Felicity " .. name .. " [" ..level.. "], Cast Your New Spell.", TALKTYPE_ORANGE_1)
        else
            doPlayerSendTextMessage(cid,19,"You " ..  name .. " [" ..level.. "], need to be Level 100 or More To Use It.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
else
   Item(item.uid):remove(1)
            doPlayerSendTextMessage(cid,19,"Sorry " ..  name .. " [" ..level.. "], You Have Done The Q Before.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end   
return TRUE
end
Post automatically merged:

Lua Script Error: [Action Interface]
data/actions/scripts/Mana Max.lua:eek:nUse
data/actions/scripts/Mana Max.lua:7: attempt to index global 'player' (a nil val
ue)
Post automatically merged:

Lua Script Error: [Action Interface]
data/actions/scripts/Mana Max.lua:eek:nUse
data/actions/scripts/Mana Max.lua:7: attempt to index global 'player' (a nil val
ue)
 
Last edited:
Lua:
 local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 55)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(player, var)
  player:addMana(320)
        player:say("[Low Mana]", TALKTYPE_MONSTER_SAY)
    return doCombat(player, combat, var)
end
This works. Look at it. Maybe you can help me
Idk nothing about the New functions, but, i will try.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     if player:getStorageValue(90733) < 3 then
        if player:getLevel() > 1 then
           player:setStorageValue(90733, 3)
                  player:say("Felicity " ..player:getName().. " [" ..player:getLevel().. "], Cast Your New Spell.", TALKTYPE_MONSTER_SAY)
                  item:remove(1)
        else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You " ..player:getName().. " [" ..player:getLevel().. "], need to be Level 100 or More To Use It.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry " ..player:getName().. " [" ..player:getLevel().. "], You Have Done The Q Before.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return TRUE
end
 
Last edited:
Solution
Idk nothing about the New functions, but, i will try.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     if player:getStorageValue(90733) < 3 then
        if player:getLevel() > 1 then
           player:setStorageValue(90733, 3)
                  player:say( "Felicity ".. player:getName() .." [".. player:getLevel() .."], Cast Your New Spell.", TALKTYPE_MONSTER_SAY)
                  item:remove(1)
        else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You ".. player:getName() .." [".. player:getLevel() .."], need to be Level 100 or More To Use It.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry ".. player:getName() .." [".. player:getLevel() .."], You Have Done The Q Before.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return TRUE
end

Lua Script Error: [Action Interface]
data/actions/scripts/Mana Max.lua:eek:nUse
data/actions/scripts/Mana Max.lua:6: attempt to concatenate global 'level' (a ni
l value)
 
Idk nothing about the New functions, but, i will try.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

     if player:getStorageValue(90733) < 3 then
        if player:getLevel() > 1 then
           player:setStorageValue(90733, 3)
                  player:say( "Felicity " ..player:getName().. " [" ..player:getLevel().. "], Cast Your New Spell.", TALKTYPE_MONSTER_SAY)
                  item:remove(1)
        else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You " ..player:getName().. " [" ..player:getLevel().. "], need to be Level 100 or More To Use It.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry " ..player:getName().. " [" ..player:getLevel().. "], You Have Done The Q Before.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return TRUE
end
thanks, man
Good job, I wish you good luck
 
thanks, man
Good job, I wish you good luck

Where is "1" change to 99, so, only level 100 or higher can use the item, as write in your script
Lua:
if player:getLevel() > 1 then

As write here:
Lua:
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You " ..player:getName().. " [" ..player:getLevel().. "], need to be Level 100 or More To Use It.")

If level doesnt matter:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
     if player:getStorageValue(90733) < 3 then
           player:setStorageValue(90733, 3)
                  player:say("Felicity " ..player:getName().. " [" ..player:getLevel().. "], Cast Your New Spell.", TALKTYPE_MONSTER_SAY)
                  item:remove(1)
else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry " ..player:getName().. " [" ..player:getLevel().. "], You Have Done The Q Before.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return TRUE
end
 
Last edited:

Similar threads

Back
Top