GSMaster
Why? for money
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
From: talkactions/talkactions.xml
Write in the event of problems. Tested on TFS 0.3.5
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