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

Lua NPC which downgrade lvl on time

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey guys!

Is it a possible to make NPC which will downgrade lvl of player to 1 (also HP, mana) to time, when the player will go to next NPC and the second one will 'normal' his character?
 
LUA:
local function removeStats(cid, health, mana)
    if not isPlayer(cid) then
        return
    end
    if doPlayerGetStorageValue(cid, 88888) == -1 then
        return
    end 
    doCreatureAddHealth(cid, -health)
    doCreatureAddMana(cid, -mana)
    addEvent(removeStats, 1000, cid, health, mana)
end
the above function can be used in the 1st npc (call it with removeStats(cid, health remove, mana remove)) and then set storage 88888 on the player to 1
and the npc that will "normal" the character, can set the player's storage (88888) back to -1
LUA:
doPlayerSetStorageValue(cid, 88888, value)
 
Back
Top