• 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 Player Description: "This player has been Rebirth" (after level, voc, guild ect.)

  • Thread starter Thread starter LordVissie
  • Start date Start date
L

LordVissie

Guest
Hey guys, so It has been a while since I created a thread but I'm back!
opieop.png


What I would like to have is: A part in the player description like this:
You see Test. He is a druid. This player has been Reborned.

So I found something and that's this:
______________________________________________________________________________________________________
creaturescripts.xml:
Code:
Code:
<event type="Look" name="Rebirth" event="script" value="Rebirth.lua"/>

login.lua
Code:
Code:
registerCreatureEvent(cid, "Rebirth")

rebirth.lua
Code:
Code:
function onLook(cid, thing, position, lookDistance)
if not isPlayer(thing.uid) then
return true
end

doPlayerSetSpecialDescription(thing.uid, '. Rebirth: ' .. math.max(0, getCreatureStorage(thing.uid, 200)))
return true
end

This is my rebirthnpc.lua:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t = {}

local level = 6000
local cost = 10000

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

function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    elseif msgcontains(msg, 'rebirth') then
        selfSay('Are you ready to be reborn?', cid)
        t[cid] = 1
    elseif t[cid] == 1 then
        npcHandler:releaseFocus(cid)
        t[cid] = nil
        if msgcontains(msg, 'yes') then
            if getPlayerLevel(cid) >= level then
                if getPlayerPromotionLevel(cid) ~= 0 then
                    if doPlayerRemoveMoney(cid, cost) then
                        doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, 200)) + 1)
                        local q = "UPDATE players SET level=20,experience=98800 WHERE id="..getPlayerGUID(cid)
                        npcHandler:releaseFocus(cid)
                        doRemoveCreature(cid)
                        db.executeQuery(q)
                    else
                        selfSay('You don\'t have enough money. You need to pay ' .. cost .. ' coins to be rebirthed.', cid)
                    end
                else
                    selfSay('Please talk with The Forgotten King and promote first.', cid)
                end
            else
                selfSay('Only characters of level ' .. level .. ' or higher can be rebirthed.', cid)
            end
        else
            selfSay('Okay, come back when you are ready.', cid)
        end
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
______________________________________________________________________________________________________

I added everything but It doesn't seems to work. It gives me no errors or something else. Anyone having an idea how I can make it work?

Thanks for the help as always ;) (I'm using 0.3.6)


Regards,

LordVissie

~And If someone knows how to make the player only rebirth ones please tell me!
 
Last edited by a moderator:
Back
Top