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

Console, Script Needs a fix.

Status
Not open for further replies.

Onizuka

Member
Joined
Jul 5, 2008
Messages
2,291
Reaction score
14
Hey, thanks for looking here.


Anyways, the console of the server is being spammed by a error in this lua script:




Error: From Console

LUA:
Data/creaturescripts/scripts/antibug.lua:6 attempt to index global 'pos' <a nil value>



Script:

LUA:
function onThink(cid, interval)
	if not getTileThingByPos(getCreaturePosition(cid)) then
		return false
	end

	local pos = {x = pos.x - 1, y = pos.y, z = pos.z}
	if getTilePzInfo(getCreaturePosition(cid)).ProtectionZone and isPlayerPzLocked(cid) then
		db.executeQuery("INSERT INTO `z_bugs` VALUES (NULL, "..getPlayerGUID(cid)..", "..(position.x)..", "..(position.y)..","..(position.z)..",0)")
		doTeleportThing(cid, pos)
		doCreatureSay(cid, "There is Protection Zone and you`re PZ-LOCKED.", TALKTYPE_ORANGE_1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "[Server] WARNING! You will get BAN if you continue attempting to Protection Zone with PZ-LOCK!")
		setPlayerStorageValue(Cid, 53451, 53451+1)
	end
	if getPlayerStorageValue(Cid, 53454) == 3 then
		doAddBanishment(getAccountIdByName(cid), 1 * 3600, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
		doRemoveCreature(cid)
	end
return true
end


And in creaturescripts.xml

Code:
<event type="think" name="AntiBug" event="script" value="antibug.lua"/>


Thanks a lot for helping out!


Regards,
Anco.
 
where is declared position? lol xdddd
change
local pos = {x = pos.x - 1, y = pos.y, z = pos.z}
to
local pos = getCreaturePosition(cid)
local position = {x = pos.x - 1, y = pos.y, z = pos.z}
 
try change this
if getTilePzInfo(getCreaturePosition(cid)).ProtectionZone
to this
if getTilePzInfo(getCreaturePosition(cid)).ZONE_PROTECTION
and change
if getPlayerStorageValue(Cid)
to
if getPlayerStorageValue(cid)
 
Code:
function onThink(interval, lastExecution, thinkInterval)
	for _, cid in ipairs(getPlayersOnline()) do
		local pos = getThingPos(cid)
		if getTileInfo(pos).protection and isPlayerPzLocked(cid) then
			db.executeQuery("INSERT INTO `z_bugs` VALUES (NULL, " .. getPlayerGUID(cid) .. ", " .. pos.x .. ", " .. pos.y .. "," .. pos.z .. ", 0)")
			pos.x = pos.x-1
			doTeleportThing(cid, pos)
			doCreatureSay(cid, "There is Protection Zone and you`re PZ-LOCKED.", TALKTYPE_ORANGE_1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Server WARNING! You will get BANNED if you continue attempting to enter Protection Zone with PZ-LOCK!")
			setPlayerStorageValue(cid, 53451, 53451 + 1)
		end
		if getPlayerStorageValue(Cid, 53454) % 3 == 0 then
			doAddAccountBanishment(getAccountIdByName(getPlayerName(cid)), cid, os.time() + 3600, 23, ACTION_BANISHMENT, "Abusing PZ bug while PZ-blocked")
			doRemoveCreature(cid)
		end
	end
	return true
end
 
Status
Not open for further replies.
Back
Top