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

[Request] NPC to downgrade your level? Reset with same HP and Mana?

Binho®

KooL =D
Joined
May 27, 2008
Messages
344
Reaction score
0
Location
BrZ Style
Is possible?
An NPC that could reset your level. Style MU?
An Example:

I have a char with level 400.
I like who this char reset your level to 8 with same quantity of HP and Mana of level 400.

This is possible editing your database manualy. Sux

Then, a npc with dialogs:

Code:
Player: Hi
NPC: Hello <Player>, what your want?
Player: Reset
NPC: Oh, great player wants to reset your level, you must have level 400. This change is irreversible, continue?
Player: Yes
NPC: Done, you are reseted.

If the player d'not have the level required...

Code:
Player: Hi
NPC: Hello <Player>, what your want?
Player: Reset
NPC: Oh, great player wants to reset your level, you must have level 400. This change is irreversible, continue?
Player: Yes
NPC: Sorry, your do not have level required to reset.


Thanks !! :)
 
This code will maybe work....
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
    dofile("./config.lua")
    env = assert(luasql.mysql())
    con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end
        if msgcontains(msg, 'reset') then
            if isPlayer(cid) == TRUE then
                npcHandler:say('Oh, great player wants to reset your level, you must have level 400. This change is irreversible, continue?', cid)
                talk_state = 1
            end
------------------------------------------------ Confirm: No ----------------------------------------------------
        elseif msgcontains(msg, 'no') and talk_state <= 1 then
            if isPlayer(cid) == TRUE then
                npcHandler:say('Ok, thanks anyways.', cid)
                talk_state = 0
            end
------------------------------------------------ Confirm: yes ---------------------------------------------------
        elseif msgcontains(msg, 'yes') and talk_state <= 1 then
            if isPlayer(cid) == TRUE and getPlayerLevel(cid) >= 400 then
                assert(con:execute("UPDATE `players` SET `level`=8, `experience`=4200;"))
                npcHandler:say('Done, you are reseted.', cid)
                talk_state = 0
            else
                npcHandler:say('Sorry, your do not have level required to reset.', cid)
                talk_state = 0
            end
        end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
[/LEFT]
 
if isPlayer(cid) == TRUE and getPlayerLevel(cid) >= 400 then
assert(con:execute("UPDATE `players` SET `level`=8, `experience`=4200;"))
npcHandler:say('Done, you are reseted.', cid)
talk_state = 0
else

that won't work, you need to first kick them, then execute the query, else they will get lvl 400 ones they log out again...

Also your query would reset EVERY PLAYER
 
if isPlayer(cid) == TRUE and getPlayerLevel(cid) >= 400 then
assert(con:execute("UPDATE `players` SET `level`=8, `experience`=4200;"))
npcHandler:say('Done, you are reseted.', cid)
talk_state = 0
else

that won't work, you need to first kick them, then execute the query, else they will get lvl 400 ones they log out again...

Also your query would reset EVERY PLAYER

If the player kick after the NPC talk with him? (The player log out after talking with NPC?) Work?
 
Back
Top