• 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 Changename in-game

Yea, for such strings you can use a forbidden table, but also patterns if you want.
But currently you also allow characters like ² etc., those are type-able ingame easily. This might even cause security flaws. Especially since you didn't censor " out ("\"") it might result in sql injections in other scripts or on the website.
 
Try now. >>1472757
If that works and I got more time, I'll try to do what TGYoshi said.
 
Code:
You do not have enough premium points
my account have 15000 premium points xD, whats wrong?

Edit: i trying using Ratser script
 
Both scripts (from me and from Lucas) use items not premium points. Change the itemId (and count) in the table.
 
now say
Code:
You can not use symbols

Triying using /changename Jose
 
Ok I did it like TGYoshi said (and learned how to use patterns in the process)...
Lua:
local itemId, count, maxTextLenght, delay = 1111, 1, 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(getPlayerItemCount(cid, itemId) < 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 `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
 
Last edited:
Error console D:
Code:
[18:26:40.506] [Error - LuaInterface::loadFile] data/talkactions/scripts/changen
ame.lua:20: unexpected symbol near '%'
[18:26:40.506] [Warning - Event::loadScript] Cannot load script (data/talkaction
s/scripts/changename.lua)
[18:26:40.508] data/talkactions/scripts/changename.lua:20: unexpected symbol nea
r '%
 
Bad copypasta (my fault). Try again now.
 
Code:
You can not use symbols

Triying /changename Jose /changename Antonio /changename David

D:
 
Changed the pattern. Try now.
Try writing the name completely in uppercase and lowercase letters.
Example:
/changename jose
and
/changename JOSE
 
works but i cant put 2 names example: Rug Zwtica or David Casz and need limit letters

Edit: and yes i can changename to JoSe or jOsE
 
yes but now i can put names as: Jose--------------David (- = spaces) so much spaces D:
 
same problem name: /changename JoSe------------------FFFEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRxxxxxxxxxxxx

(- = Spaces)
 
same problem: You see JoSeEeE---------------ZxsDT (Level 320). He is a druid.
 
I'm gonna need to test it in my server (print values and see what's wrong), which is gonna take some time (or maybe not...who knows).
At least it's not a big thing, just a small bug with the spaces amount.
If anyone can fix it feel free to post a solution.
 
Last edited:
Back
Top