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

Sell namelock or namechange

MxSoft

Leave Tibia, Live Life.
Joined
Dec 22, 2009
Messages
1,804
Solutions
1
Reaction score
43
Location
Mexico
Is there a way to sell a name-lock to players, in my webpage the Change name doesn't works.
If someone have a way to sell name change i would appreciate if it is shared.
 
En data/libs crea 048-ppoints.lua
Lua:
function getAccountPoints(cid)
    local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
    if(res:getID() == -1) then
       return false
    end
    local ret = res:getDataInt("premium_points")
    res:free()
    return tonumber(ret)
end

En data/talkactions/script crea changename.lua
Lua:
local count, maxTextLenght, delay = 10, 15, 2 * 1000
local blacklistParam = {"god", "cm", "gm", "tutor", "tester"}
 
function onSay(cid, words, param, channel)
	local text, continue = "You will be kicked in 2 seconds.", true
	local stringSpaceStart, stringSpaceEnd = string.find(param, "[%s]*")
	if(db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(param) .. ";"):getID() ~= -1) then
		text, continue = "That name is already in use.", false
	elseif(getAccountPoints(cid) < count) then
		text, continue = "You do not have enough premium points.", false
	elseif(not getTilePzInfo(getCreaturePosition(cid))) then
		text, continue = "You must be inside a protection zone to use this command.", false
	elseif(not tostring(param)) then
		text, continue = "Invalid parameter.", false
	elseif((stringSpaceEnd - stringSpaceStart) > 1) then
		text, continue = "Parameter contains too much spaces.", false
	elseif(string.len(tostring(param)) > maxTextLenght) then
		text, continue = "You can use a maximum of " .. maxTextLenght .. " characters.", false
	elseif(string.find(param:lower(), "[^%l%s]") ~= nil) then
		text, continue = "You can not use symbols.", false
	else
		for blacklist = 1, table.maxn(blacklistParam) do
			if(string.find(param:lower(), blacklistParam[blacklist]) ~= nil) then
				text, continue = "Invalid name entry.", false
				break
			end
		end
	end
 
	if(continue == false) then
		doPlayerSendCancel(cid, text)
		return true
	end
	db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'")
	db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(param) .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
	doPlayerRemoveItem(cid, itemId, count)
	doPlayerSendTextMessage(cid, 25, text)
	addEvent(function(cid, forceLogout)
		if(isPlayer(cid)) then
			doRemoveCreature(cid, forceLogout)
		end
	end, delay, cid, false)
	return true
end

Talkactions:
XML:
<talkaction words="!changename" event="script" value="changename.lua"/>

Lo adapte del script de LucasOlzon y Ratser.

PD. Me cambias mi nombre gratis por el aporte si :) PM me
 
I tested this script a long time ago, it doesnt works at all, if you says just !changename your character get buged because in database he dont have name. So to make this system work wou need to add a if player name is not 3 letters or more says"Invalid Name Format"
 
Back
Top