• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Check spellwords for value?

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
844
Reaction score
63
I want to check what spell words the player is using, then set a storage value based on the spellStats table.
Mystic Spirit 0.2.15
This is what I have so far:

Code:
spellStats =
{
    ["fire"] = {    LVL = 1},
    ["ice"] = {    LVL = 1}
}

function onCastSpell(cid, var)
    local spellwords = ????
    local spellName = spellStats[spellwords:lower()]  
    if spellwords == spellName then
        setPlayerStorageValue(cid, 10000, spellName.LVL)
        return true
    else
        return false
    end
end
 
try
Code:
if(param == spellStats[param:lower()]) then
Or skip the table
Code:
if(param == fire) then
 
Code:
local spellName = {
    ["fire"] = {    LVL = 1},
    ["ice"] = {    LVL = 1}
}
function onCastSpell(cid, var)
    local spellName = spellStats[spellwords:lower()]  
    if(param == spellName) then
        setPlayerStorageValue(cid, 10000, spellName.level )
        return true
    else
        return false
    end
end

My server isent online, but according to lua demo: Your program ran successfully.
 
Spellwords, and param are nil values.
I know in talkactions that param is a value that works, but not the same with spells.
 
Last edited:
sorry, I've missread what you actually wanted.
I thought you wanted to get the param words of the spell not the spell name itself :p
either just insert it local in all the spells you need it to be in.
Something like this:
Code:
spellStats =
{
   ["fire"] = {storage = {key = 10000, value = 1}, lvl = 1},
   ["ice"] = {storage = {key = 10001, value = 1}, lvl = 1}
}

function onCastSpell(cid, var)
local spellWords = "fire"
   if spellStats[spellWords] then
     setPlayerStorageValue(cid, spellStats[spellWords].storage.key, spellStats[spellWords].storage.value)
     return true
   else
     return false
   end
end
or you'll have to mess around in your source code to insert the spellwords as a param in your onCast function.
 
Last edited:
@up - That is still not properly checking if I am casting the spell. That is just simply checking for a value that isn't triggered.
 
Back
Top