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

TalkAction /namelock (for online players)

GSMaster

Why? for money
Joined
Oct 26, 2008
Messages
160
Best answers
0
Reaction score
8
Location
HKS <3
This script allows you to change the name of a player who is online. Can be set to a particular player took up days PACC. The script also checks whether you are ONLINE, PACC is whether the new name is not already busy, name must contain 4 characters min. (explained in translate.google.pl)

Example:
/namelock GSMaster;GSM's

/namelock - Comands
GSMaster - Current name
; - Separates
GSM's - New name

Function changeName and setPlayerName borrowed from OTAL 1.21.


From: talkactions/script/namelock.lua
Lua:
-- NameLock by GSMaster


function changeName(guid,name,old) -- by O.T.A.L
   db.executeQuery('UPDATE `'..sqlDatabase..'`.`players` SET `name` = "'..name..'" WHERE `players`.`id` ='..guid..' AND CONVERT( `players`.`name` USING utf8 ) = "'..old..'" LIMIT 1 ;')
end

function setPlayerName(cid,name)  -- by mock (O.T.A.L)
guid = getPlayerGUID(cid)
dofile("config.lua")
local coisa = db.getResult("SELECT `name` FROM `"..sqlDatabase.."`.`players` WHERE `id` = ".. guid ..";")
if coisa ~= nil then
  old = coisa:getDataString("name")
  addEvent(doRemoveCreature, 100, cid)
  addEvent(changeName, 200, guid,name,old)
  end
end

local config = {
RemovePremium = false, -- Remove premium days ? true/false
RemovePremiumDay = 5 -- how much remove 1,2,3,4 etc..
}

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
	
	local t = string.explode(param, ";")
	if(not t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No new name specified.")
		return true
	end
	
	local pid = getPlayerByNameWildcard(t[1])
	if(not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid))) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
		return true
	end
	
	if getPlayerGUIDByName(t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "New name is busy.")
		return true
	end
	
	local characters = 0
     for p = 1, string.len(t[2]) do
       characters = characters+1
     end
	 
	if characters < 4 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "New name must contain at least 4 characters.")
		return true
	end
	
	if config.RemovePremium == true then
			if getPlayerPremiumDays(pid) < config.RemovePremiumDay then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The player does not have the required quantities of PACC!.")
				return true
			end
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Changing name successful.")
		setPlayerName(pid,t[2])
		doPlayerRemovePremiumDays(pid, config.RemovePremiumDay)
	else
		setPlayerName(pid,t[2])
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Changing name successful.")
		return true
	end
	return true
end
From: talkactions/talkactions.xml
Code:
<talkaction log="yes" words="/namelock" access="5" event="script" value="namelock.lua"/>
Write in the event of problems. Tested on TFS 0.3.5
 

Grehy

Killroy
Joined
Nov 21, 2008
Messages
2,628
Best answers
0
Reaction score
31
Location
United States
I don't see the need for this too much when you just can use ctrl+y and have more control over what you say kind of
 

Exmortis

Member
Joined
Jun 27, 2008
Messages
189
Best answers
0
Reaction score
5
Did not work on TFS 0.2.7 (if anybody wonders)
 

Davlog

New Member
Joined
Jul 4, 2011
Messages
15
Best answers
0
Reaction score
0
doesnt work :(

10:13 /namelock Miny ;GM Miny
10:14 You see Miny. She is gamemaster.

i reloged but nothing happened
 

ALLOSAURUS

New Member
Joined
Mar 5, 2009
Messages
3
Best answers
0
Reaction score
0
OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such table: theforgottenserver.players (SELECT "name" FROM "theforgottenserver"."players" WHERE "id" = 2;)

[09/02/2012 10:18:18] [Error - TalkAction Interface]
[09/02/2012 10:18:18] data/talkactions/scripts/namelock.lua:eek:nSay
[09/02/2012 10:18:18] Description:
[09/02/2012 10:18:18] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[09/02/2012 10:18:18] stack traceback:
[09/02/2012 10:18:18] [C]: in function 'error'
[09/02/2012 10:18:18] data/lib/004-database.lua:76: in function 'getDataString'
[09/02/2012 10:18:18] data/talkactions/scripts/namelock.lua:10: in function 'setPlayerName'
[09/02/2012 10:18:18] data/talkactions/scripts/namelock.lua:63: in function <data/talkactions/scripts/namelock.lua:21>

D:
 

Skipi11111

New Member
Joined
Nov 22, 2013
Messages
8
Best answers
0
Reaction score
0
[22/11/2013 13:37:46] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such table: theforgottenserver.players (SELECT "name" FROM "theforgottenserver"."players" WHERE "id" = 2;)

[22/11/2013 13:37:46] [Error - TalkAction Interface]
[22/11/2013 13:37:46] data/talkactions/scripts/namelock.lua:eek:nSay
[22/11/2013 13:37:46] Description:
[22/11/2013 13:37:46] data/lib/004-database.lua:76: [Result:getDataString] Result not set!
[22/11/2013 13:37:46] stack traceback:
[22/11/2013 13:37:46] [C]: in function 'error'
[22/11/2013 13:37:46] data/lib/004-database.lua:76: in function 'getDataString'
[22/11/2013 13:37:46] data/talkactions/scripts/namelock.lua:6: in function 'setPlayerName'
[22/11/2013 13:37:46] data/talkactions/scripts/namelock.lua:59: in function <data/talkactions/scripts/namelock.lua:17>



HELP :D
 
Top