• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Command /rename with suggested name

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
before anythig i will say, YES you can use name report or use this.
This script you can set the name or a random name.
Code:
/rename Mock, bear
/rename Mock
if fisrt case it rename Mock to bear, in second case it rename mock to a sugested name.

The function to generate a sugested name it generate some woerds joining some letters.
Look some generated names:
Fuduyig Capefosuo
Celijimoe
Iupisae Baye
Hotec
Bixesima
And another beautiful fucking ugly names :thumbup:
Also you can do it:
19:07 /rename gen
19:07 Mock: suggested name: Xutuyi
Wathever lets install
Add this tag on talkactions.xml
Code:
<talkaction log="yes" words="/rename" access="5" event="script" value="rename.lua"/>
And rename.lua
Lua:
--Player rename by Mock the bear (MTB)
function sugested() --GName generator
	local cons = {'b','c','d','f','g','h','i','j','k','l','m','n','  p','q','r','s','t','v','x','y','z'}
	local vog = {"a",'e','i','o','u'}
	local sibalas = {}
	for i=1,#cons do
	   for e=1,#vog do
		  table.insert(sibalas,1,cons[i]..vog[e])
	   end
	end
    local total = ""
    for i=1,math.random(1,2) do
		local nam = ""
		for i=1,math.random(2,4) do
			nam = nam..sibalas[math.random(1,#sibalas)]
		end
		if math.random(1,2) == 1 then
		   nam = nam..vog[math.random(1,#vog)]
		elseif math.random(1,2) == 2 then
		   nam = nam..cons[math.random(1,#vog)]
		end
		total = total..(i == 2 and ' ' or '')..nam:sub(1,1):upper()..nam:sub(2,-1)
    end
	return total
end
function onSay(cid, words, param, channel)
	if param == 'gen' then
		doCreatureSay(cid,'Suggested name: '..sugested(),1)
		return true
	end
	local param1,param2 = param:match('(.-)[;:,.]%s*(.+)')
	param = param1 or param
	param2 = param2 or sugested()
	if not param then
		doPlayerSendTextMessage(cid,25,'Use like this: /rename Old name, New name')
		return true
	end
	if param2:len() <= 2 or param2:len() > 20 then
		doPlayerSendTextMessage(cid,25,'Please 3-20 characters.')
		return true
	end
	if param2:match('[%a%d%s%u%l]+') ~= param2 then
		doPlayerSendTextMessage(cid,25,'Please only A-Z 0-9')
		return true
	end
	param2 = param2:sub(1,1):upper()..param2:sub(2,-1)

	local p2 = getPlayerByName(param)
	if p2 and isPlayer(p2) then
		local id = getPlayerGUID(p2)
		doPlayerPopupFYI(p2,'Changing your name. Please login aigan on your character list.')
		addEvent(doRemoveCreature,2000,p2)
		addEvent(function(id,param2)
			db.executeQuery("UPDATE `players` SET `name` =  '"..param2.."' WHERE `id` ="..id)
		end,2100,id,param2)
	else
		doPlayerSendTextMessage(cid,25,'Player '..param..' not found.')
		return true
	end
	return TRUE
end
Enjoy
wink.gif
 
Last edited:
nice one but someone already made something like this
>edit mistake it is kind of diff
 
Last edited:
add something like

Lua:
    for _, i in ipairs({"cm", "gm", "god", "fuck"}) do
        if (param:lower():match(i)) then
            return cancel msg (?)
        end
    end
 
@Nahruto
thx but dont need, only AMDs can use it.
if some adm want rename a GM? :D
 
I dont know why but it doesnt work for me.
When i say the command nothing happens...

Using TFS 0.3.6 pl1
 
Code:
[21/06/2010 13:11:36] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/rename.lua:43: ')' expected near 'only'
[21/06/2010 13:11:36] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/rename.lua)
[21/06/2010 13:11:36] data/talkactions/scripts/rename.lua:43: ')' expected near 'only'

TFS 0.3.6
 
Possible to make it need a item to change name? like for example '!changename Billy' and it will take a itemid (not crystal coins)
 
Back
Top