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

Gesior TFS 0.3.6pl1 Change name in shop.

beybus

New Member
Joined
Oct 2, 2010
Messages
110
Reaction score
2
Hello, i just activated change name in my shop.
Can u guys tell me how can i block names like [GOD] etc?
 
You could do something in the NPC script where it gets their access level, and if the player's access level is higher than x, then the NPC will reject them, if that's what you mean.
 
What if he doesn't? You want to play the "what if game" or help?

It's not hard to fix.

!changename Oldname, Newname
example: !changename Cronox,Cronoxs

data/talkactions/scripts

changename.lua

LUA:
local MIN = 5
local MAX = 10
function onSay(cid, w, p, channel)
	if not p or p == "" then
		doPlayerSendCancel(cid, "Command requires param.")
		return true
	end
	if w == "!changename" then
		local long = p[2]:len() > MAX
		local short = p[2]:len() < MIN
		if long or short then
			doPlayerSendCancel(cid, "Sorry, your name is too " .. (long and "long." or "short."))
			return true
		end
 
		if db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1 then
			doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.")
			return true
		end
 
		if db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1 then
			doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.")
			return true
		end
 
		doRemoveCreature(cid)
		addEventdb.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';")
	end
 
	return true
end

Note: Don'tWorks and have error in querys.. change db.executeQuery for db.query
 
Back
Top