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

Lua Bug in unban command

picachu

Member
Joined
Dec 2, 2007
Messages
970
Reaction score
11
Hello!
I'm using TFS 0.3.5pl1 and when i write /unban banned player i give one error in .exe

Code:
'data/talkactions/scripts/unban.lua:16: attempt to call global 'doRemoveBanishment' <a nil value>
stack traceback
data/talkactions/scripts/unban.lua:16: in funcion <data/talkactions/scripts/unban.lua:1>`
 
Try with this, go to
data/talkactions/sctipts
open Unban.lua
erase everything inside and write this:

Code:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local tmp = getAccountIdByName(param)
	if(tmp == 0) then
		tmp = getAccountIdByAccount(param)
		if(tmp == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.")
			return true
		end
	end

	if(isAccountBanished(tmp) and doRemoveBanishment(tmp)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, tmp .. " has been unbanned.")
	end

	if(isAccountDeleted(tmp) and doRemoveDeletion(tmp)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, tmp .. " has been undeleted.")
	end

	if(getPlayerViolationAccess(cid) > 2) then
		local ip = getIpByName(param)
		if(isIpBanished(ip) and doRemoveIpBanishment(ip)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.")
		end

		if(isPlayerNamelocked(param) and doRemoveNamelock(param)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.")
		end
	end
	return true
end
 
Hello, I had the same problem here, and I could resolve with this script:
Code:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local account, tmp = getAccountIdByName(param), true
	if(account == 0) then
		account = getAccountIdByAccount(param)
		if(account == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.")
			return true
		end

		tmp = false
	end

	local ban = getBanData(account, BAN_ACCOUNT)
	if(ban and doRemoveAccountBanishment(account)) then
		local name = param
		if(tmp) then
			name = account
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, name .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
	end

	if(not tmp) then
		return true
	end

	tmp = getIpByName(param)
	if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.")
	end

	local guid = getPlayerGUIDByName(param, true)
	if(guid == nil) then
		return true
	end

	ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_LOCK)
	if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_LOCK)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.")
	end

	ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_BANISHMENT)
	if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_BANISHMENT)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
	end

	return true
end

I have helped,
hugs :peace:
 

Similar threads

Back
Top