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

Command !exp !mana TFS 1.0

Really? It's like a 4 line code.
Code:
function onSay(player, param)
  player:sendTextMessage(player:getExperience(), MESSAGE_INFO_DESCR) /player:getMaxMana()
  return false
end

Psudo code written on my phone so u'll have to look up the exact function names and param urself. Think u can handle that, sport?
 
Really? It's like a 4 line code.
Code:
function onSay(player, param)
  player:sendTextMessage(player:getExperience(), MESSAGE_INFO_DESCR) /player:getMaxMana()
  return false
end

Psudo code written on my phone so u'll have to look up the exact function names and param urself. Think u can handle that, sport?
unexpected symbol near '/'
 
If you actually read my post you'll see that i said that the code isn't proper, if you can't even google the solution you probably shouldn't open a server in the first place cuz it will probably die as soon as a bug is found.

If you're going to help someone, the least you can do is not be a dick about it. If you don't have anything nice to say, say nothing at all.
 
Paste your full script here after you made the edits.
PHP:
function onSay(cid, words, param)
local player = Player(cid)
local s = function(p, lv)
       local k = Game.getExperienceStage(lv)
       local st = p:getStamina()
         if st > 2400 then
           return k*1.5 .. " (stamina bonus)"
         elseif st < 1 then
           return 0 .. " (out of stamina)"
         elseif st < 841 then
           return k*0.5 .. " (stamina penalty)"
         else
           return k
         end
       end

   if words == "!exp" then
     local lv = p:getLevel()
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. ((50 * lv^3) - (150 * lv^2) + (400 * lv)) / 3 - p:getExperience() .. " experience more, for " .. lv+1 .. " level.")
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Current rate: x" .. s(p, lv))
     return false
   end
  p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to spend " .. math.ceil((p:getVocation():getRequiredManaSpent(p:getBaseMagicLevel() + 1) - p:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC))  .. " mana more, for next magic level.")
return false
end
 
PHP:
function onSay(cid, words, param)
local player = Player(cid)
local s = function(p, lv)
       local k = Game.getExperienceStage(lv)
       local st = p:getStamina()
         if st > 2400 then
           return k*1.5 .. " (stamina bonus)"
         elseif st < 1 then
           return 0 .. " (out of stamina)"
         elseif st < 841 then
           return k*0.5 .. " (stamina penalty)"
         else
           return k
         end
       end

   if words == "!exp" then
     local lv = p:getLevel()
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. ((50 * lv^3) - (150 * lv^2) + (400 * lv)) / 3 - p:getExperience() .. " experience more, for " .. lv+1 .. " level.")
     p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Current rate: x" .. s(p, lv))
     return false
   end
  p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to spend " .. math.ceil((p:getVocation():getRequiredManaSpent(p:getBaseMagicLevel() + 1) - p:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC))  .. " mana more, for next magic level.")
return false
end

Change:
local player = Player(cid)
to
local p = Player(cid)
 
Back
Top