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

[REQUEST] Talkactions TP/Add Outfit

armitxe

New Member
Joined
Feb 15, 2009
Messages
65
Reaction score
1
Hello everyone...

If you guys can help me.. Thank you very much!

I would like to have this 2 talkaction.

1: Teleport Back.

What's teleport back?. When we are GM's or in my case i usually summon players to where i'm to serve them.

The problem is, that in i took them from the caves or wherever they were, and now they have to go walking back...

The teleport back, is a cmd that teleport they to where they was before they got summoned... Is that possible?

2: Add Outfit Talkaction.

This one is much easier.. (i think XD) and is more like a question...

I tried to make a CMD that add's an X outfit to a player... I use it like reward of a event.. for example the Outfit of a Demon, or elf.. etc...

Here is the code i made: (Or well.. this is taked from the /newtype, i only change the "doCreatureChangeOutfit" to a "doPlayerAddOutfit".

Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local t = string.explode(param, ",")
	t[1] = tonumber(t[1])
	if(not t[1]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
		return TRUE
	end

	if(t[2]) then
		cid = getPlayerByNameWildcard(t[2])
		if(cid == 0 or (isPlayerGhost(pid) == TRUE and getPlayerAccess(pid) > getPlayerAccess(cid))) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
			return TRUE
		end
	end

	if(t[1] < 0 or t[1] == 1 or t[1] == 135 or (t[1] > 160 and t[1] < 192) or t[1] > 326) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
		return TRUE
	end

	local tmp = getCreatureOutfit(cid)
	tmp.lookType = t[1]
	doPlayerAddOutfit(cid, tmp, 3)
	return TRUE
end

The problem i got is just.. It dont give the outfit!, i don't know why, but the player doesn't get the outfit... I try to put the looktype in the "outfit.xml" in enable = 0 to see if it works, and i don't.

Code:
<outfit type="1" looktype="159" enabled="0" name="Elf" premium="1"/>

So, someone may please help me to fix it?, or tell me if that is possible?

These two talkactions are the ones who i would love to have...!

Thank you very much in advance for read and for help me...! xD
 
#outfit
Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local t = string.explode(param, ",")
	t[1] = tonumber(t[1])
	if(not t[1]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
		return TRUE
	end

	if(t[2]) then
		cid = getPlayerByNameWildcard(t[2])
		if(cid == 0 or (isPlayerGhost(pid) == TRUE and getPlayerAccess(pid) > getPlayerAccess(cid))) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
			return TRUE
		end
	end

	if(t[1] < 0 or t[1] == 1 or t[1] == 135 or (t[1] > 160 and t[1] < 192) or t[1] > 326) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
		return TRUE
	end

	doPlayerAddOutfit(cid, t[1], 3)
	return TRUE
end
 
The first one is quite easy. It could be done with storagevalues. I'll do it as soon as I get back from school.
 
Change your 'teleportthere.lua' on /data/talkactions/scripts with this:
Lua:
local config = {
	x = 1333,
	y = 1334,
	z = 1335
}

function onSay(cid, words, param, channel)

	if words == '/c' then
		if(param == '') then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
			return true
		end

		local target = getPlayerByNameWildcard(param)
		if(not target) then
			target = getCreatureByName(param)
			if(not target) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
				return true
			end
		end

		if(isPlayerGhost(target) and getPlayerAccess(target) > getPlayerAccess(cid)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
			return true
		end

		local pos = getClosestFreeTile(target, getCreaturePosition(cid), false, false)
		if(not pos or isInArray({pos.x, pos.y}, 0)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
			return true
		end

		local tmp = getCreaturePosition(target)
		if isPlayer(target) then
			doPlayerSetStorageValue(target, config.x, getCreaturePosition(target).x)
			doPlayerSetStorageValue(target, config.y, getCreaturePosition(target).y)
			doPlayerSetStorageValue(target, config.z, getCreaturePosition(target).z)
		end
		if(doTeleportThing(target, pos, true) and not isPlayerGhost(target)) then
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
		end
		
	else
	
		if(param == '') then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
			return true
		end

		local pid = getPlayerByNameWildcard(param)
		if(not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid))) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
			return true
		end

		local player = getPlayerByNameWildcard(param)
		local pos = {x = 0, y = 0, z = 0}

		if getPlayerStorageValue(pid, config.x) ~= -1 then
			pos = {x = getPlayerStorageValue(pid, config.x), y = getPlayerStorageValue(pid, config.y), z = getPlayerStorageValue(pid, config.z)}
			setPlayerStorageValue(pid, config.x, -1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player has not been summoned.")
			return true
		end

		if(not pos or isInArray({pos.x, pos.y}, 0)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
			return true
		end

		pos = getClosestFreeTile(cid, pos, true)
		if(not pos or isInArray({pos.x, pos.y}, 0)) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
			return true
		end

		local tmp = getCreaturePosition(pid)
		if(doTeleportThing(pid, pos, true) and not isPlayerGhost(pid)) then
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
		end
	end
	return true
end

And on data/talkactions/talkactions.xml add this line:
<talkaction log="yes" words="/sendback" access="3" event="script" value="teleporthere.lua"/>
 
Last edited:
#outfit
Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local t = string.explode(param, ",")
	t[1] = tonumber(t[1])
	if(not t[1]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
		return TRUE
	end

	if(t[2]) then
		cid = getPlayerByNameWildcard(t[2])
		if(cid == 0 or (isPlayerGhost(pid) == TRUE and getPlayerAccess(pid) > getPlayerAccess(cid))) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
			return TRUE
		end
	end

	if(t[1] < 0 or t[1] == 1 or t[1] == 135 or (t[1] > 160 and t[1] < 192) or t[1] > 326) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
		return TRUE
	end

	doPlayerAddOutfit(cid, t[1], 3)
	return TRUE
end

Thanks, but it still don't work :S, it don't give the outfit to the player...

@Santy

Thanks too for answer me!, but i got a error :S

Code:
[18/12/2009 16:02:52] Lua Script Error: [TalkAction Interface] 
[18/12/2009 16:02:52] data/talkactions/scripts/teleporthere.lua:onSay

[18/12/2009 16:02:52] data/talkactions/scripts/teleporthere.lua:24: attempt to call global 'getPlayerGhostAccess' (a nil value)
[18/12/2009 16:02:52] stack traceback:
[18/12/2009 16:02:52] 	data/talkactions/scripts/teleporthere.lua:24: in function <data/talkactions/scripts/teleporthere.lua:7>
 
I'm using TFS 0.3.3 (Crying Damson)

Tibia 8.42

This is what contains my old teleporthere if u need it:

Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local target = getPlayerByNameWildcard(param)
	if(target == 0) then
		target = getCreatureByName(param)
		if(target == 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
			return TRUE
		end
	end

	if(isPlayer(target) == TRUE and isPlayerGhost(target) == TRUE and getPlayerAccess(target) > getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
		return TRUE
	end

	local pos = getClosestFreeTile(target, getCreaturePosition(cid))
	if(pos == LUA_ERROR or isInArray({pos.x, pos.y, pos.z}, 0) == TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return TRUE
	end

	local tmp = getCreaturePosition(target)
	if(doTeleportThing(target, pos, TRUE) ~= LUA_ERROR and isPlayerGhost(target) ~= TRUE) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return TRUE
end
 
Last edited:
Fixed. It should now work. I'm going to leave now. I'm sorry I wont be able to reply. I'll come back in 5-6 hours, though.
 
@Santy
Thank you very much again... But it still don't working :/

Now, there's no error in the server screen, but when i say the command it says "20:27 Cannot perform action.". Now i can't use the cmd "/c", and plus it says the cmd in yellow letters, like when u talk xD

I think is my server.. idk..

Thanks too for help me!
 
Lua:
  local config = {
        x = 1333,
        y = 1334,
        z = 1335
}

function onSay(cid, words, param, channel)

        if words == '/c' then
			if(param == "") then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
				return TRUE
			end

			local target = getPlayerByNameWildcard(param)
			if(target == 0) then
				target = getCreatureByName(param)
				if(target == 0) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
					return TRUE
				end
			end

			if(isPlayer(target) == TRUE and isPlayerGhost(target) == TRUE and getPlayerAccess(target) > getPlayerAccess(cid)) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
				return TRUE
			end

			local pos = getClosestFreeTile(target, getCreaturePosition(cid))
			if(pos == LUA_ERROR or isInArray({pos.x, pos.y, pos.z}, 0) == TRUE) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
				return TRUE
			end

			local tmp = getCreaturePosition(target)
                        setPlayerStorageValue(target, config.x, getCreaturePosition(target).x)
                        setPlayerStorageValue(target, config.y, getCreaturePosition(target).y)
                        setPlayerStorageValue(target, config.z, getCreaturePosition(target).z)
			if(doTeleportThing(target, pos, TRUE) ~= LUA_ERROR and isPlayerGhost(target) ~= TRUE) then
				doSendMagicEffect(tmp, CONST_ME_POFF)
				doSendMagicEffect(pos, CONST_ME_TELEPORT)
			end
			
        else
       
                if(param == '') then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                        return true
                end

                local pid = getPlayerByNameWildcard(param)
                if(not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                        return true
                end

                local player = getPlayerByNameWildcard(param)
                local pos = {x = 0, y = 0, z = 0}

                if getPlayerStorageValue(pid, config.x) ~= -1 then
                        pos = {x = getPlayerStorageValue(pid, config.x), y = getPlayerStorageValue(pid, config.y), z = getPlayerStorageValue(pid, config.z)}
                        setPlayerStorageValue(pid, config.x, -1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player has not been summoned.")
                        return true
                end

                if(not pos or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
                        return true
                end

                pos = getClosestFreeTile(cid, pos, true)
                if(not pos or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
                        return true
                end

                local tmp = getCreaturePosition(pid)
                if(doTeleportThing(pid, pos, true) and not isPlayerGhost(pid)) then
                        doSendMagicEffect(tmp, CONST_ME_POFF)
                        doSendMagicEffect(pos, CONST_ME_TELEPORT)
                end
        end
        return true
end

I think that should work for your distro.
 
Last edited:
Uhm...

Code:
[19/12/2009 04:26:45] Lua Script Error: [TalkAction Interface] 
[19/12/2009 04:26:45] data/talkactions/scripts/teleporthere.lua:onSay

[19/12/2009 04:26:45] data/talkactions/scripts/teleporthere.lua:36: attempt to call global 'doPlayerSetStorageValue' (a nil value)
[19/12/2009 04:26:45] stack traceback:
[19/12/2009 04:26:45] 	data/talkactions/scripts/teleporthere.lua:36: in function <data/talkactions/scripts/teleporthere.lua:7>

Sorry for being annoying...

It still don't work :S i think my distro is sooooooooooooo old :/!
Thanks for answer :)
 
Lua:
  local config = {
        x = 1333,
        y = 1334,
        z = 1335
}

function onSay(cid, words, param, channel)

        if words == '/c' then
                        if(param == "") then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                                return TRUE
                        end

                        local target = getPlayerByNameWildcard(param)
                        if(target == 0) then
                                target = getCreatureByName(param)
                                if(target == 0) then
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
                                        return TRUE
                                end
                        end

                        if(isPlayer(target) == TRUE and isPlayerGhost(target) == TRUE and getPlayerAccess(target) > getPlayerAccess(cid)) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
                                return TRUE
                        end

                        local pos = getClosestFreeTile(target, getCreaturePosition(cid))
                        if(pos == LUA_ERROR or isInArray({pos.x, pos.y, pos.z}, 0) == TRUE) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
                                return TRUE
                        end

                        local tmp = getCreaturePosition(target)
                        setPlayerStorageValue(target, config.x, getCreaturePosition(target).x)
                        setPlayerStorageValue(target, config.y, getCreaturePosition(target).y)
                        setPlayerStorageValue(target, config.z, getCreaturePosition(target).z)
                        if(doTeleportThing(target, pos, TRUE) ~= LUA_ERROR and isPlayerGhost(target) ~= TRUE) then
                                doSendMagicEffect(tmp, CONST_ME_POFF)
                                doSendMagicEffect(pos, CONST_ME_TELEPORT)
                        end
                       
        else
       
                if(param == '') then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                        return true
                end

                local pid = getPlayerByNameWildcard(param)
                if(not pid or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                        return true
                end

                local player = getPlayerByNameWildcard(param)
                local pos = {x = 0, y = 0, z = 0}

                if getPlayerStorageValue(pid, config.x) ~= -1 then
                        pos = {x = getPlayerStorageValue(pid, config.x), y = getPlayerStorageValue(pid, config.y), z = getPlayerStorageValue(pid, config.z)}
                        setPlayerStorageValue(pid, config.x, -1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player has not been summoned.")
                        return true
                end

                if(not pos or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
                        return true
                end

                pos = getClosestFreeTile(cid, pos, true)
                if(not pos or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
                        return true
                end

                local tmp = getCreaturePosition(pid)
                if(doTeleportThing(pid, pos, true) and not isPlayerGhost(pid)) then
                        doSendMagicEffect(tmp, CONST_ME_POFF)
                        doSendMagicEffect(pos, CONST_ME_TELEPORT)
                end
        end
        return true
end

Try with this.

Also, ever considered updating? :p
 
Yes i tried... but... i lost all my quest, the doors don't work, and alot of another things stop working XD..

Thanks dude.. but guess what? still don't working :/!

Now works the "/c" (but it still show like when u talk, everyone close read the cmd) but... the /sendback don't work.. it says:

Code:
19:09 /sendback zaraki kenpachi
19:09 Destination not reachable.

or it says:

Code:
19:08 /sendback zaraki kenpachi
19:08 This player has not been summoned.

T.T thanks again for answer me
 
Could you please post your luafunctions?

Also, the very first script worked for me, I'm using 0.3.5. If I were you, I seriously would consider updating.
 
Here they are:

Code:
function doPlayerGiveItem(cid, itemid, amount, subType)
	local item = 0
	if(isItemStackable(itemid) == TRUE) then
		item = doCreateItemEx(itemid, amount)
		if(doPlayerAddItemEx(cid, item, TRUE) ~= RETURNVALUE_NOERROR) then
			return LUA_ERROR
		end
	else
		for i = 1, amount do
			item = doCreateItemEx(itemid, subType)
			if(doPlayerAddItemEx(cid, item, TRUE) ~= RETURNVALUE_NOERROR) then
				return LUA_ERROR
			end
		end
	end

	return LUA_NO_ERROR
end

function doPlayerTakeItem(cid, itemid, amount)
	if(getPlayerItemCount(cid, itemid) < amount or doPlayerRemoveItem(cid, itemid, amount) ~= TRUE) then
		return LUA_ERROR
	end

	return LUA_NO_ERROR
end

function doPlayerBuyItem(cid, itemid, count, cost, charges)
	if(doPlayerRemoveMoney(cid, cost) ~= TRUE) then
		return LUA_ERROR
	end

	return doPlayerGiveItem(cid, itemid, count, charges)
end

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
	if(doPlayerRemoveMoney(cid, cost) ~= TRUE) then
		return LUA_ERROR
	end

	for i = 1, count do
		local container = doCreateItemEx(containerid, 1)
		for x = 1, getContainerCapById(containerid) do
			doAddContainerItem(container, itemid, charges)
		end

		if(doPlayerAddItemEx(cid, container, TRUE) ~= RETURNVALUE_NOERROR) then
			return LUA_ERROR
		end
	end

	return LUA_NO_ERROR
end

function doPlayerSellItem(cid, itemid, count, cost)
	if(doPlayerTakeItem(cid, itemid, count) ~= LUA_NO_ERROR) then
		return LUA_ERROR
	end

	if(doPlayerAddMoney(cid, cost) ~= TRUE) then
		error('Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')
	end

	return LUA_NO_ERROR
end

function isInRange(pos, fromPos, toPos)
	return (pos.x >= fromPos.x and pos.y >= fromPos.y and pos.z >= fromPos.z and pos.x <= toPos.x and pos.y <= toPos.y and pos.z <= toPos.z) and TRUE or FALSE
end

function isPremium(cid)
	return (isPlayer(cid) == TRUE and (getPlayerPremiumDays(cid) > 0 or getConfigInfo('freePremium') == "yes")) and TRUE or FALSE
end

function getMonthDayEnding(day)
	if day == "01" or day == "21" or day == "31" then
		return "st"
	elseif day == "02" or day == "22" then
		return "nd"
	elseif day == "03" or day == "23" then
		return "rd"
	else
		return "th"
	end
end

function getMonthString(m)
	return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function getArticle(str)
	return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

function isNumber(str)
	return tonumber(str) ~= nil and TRUE or FALSE
end

function getDistanceBetween(firstPosition, secondPosition)
	local xDif = math.abs(firstPosition.x - secondPosition.x)
	local yDif = math.abs(firstPosition.y - secondPosition.y)

	local posDif = math.max(xDif, yDif)
	if(firstPosition.z ~= secondPosition.z) then
		posDif = posDif + 9 + 6
	end
	return posDif
end

function doPlayerAddAddons(cid, addon)
	for i = 0, table.maxn(maleOutfits) do
		doPlayerAddOutfit(cid, maleOutfits[i], addon)
	end

	for i = 0, table.maxn(femaleOutfits) do
		doPlayerAddOutfit(cid, femaleOutfits[i], addon)
	end
end

function isSorcerer(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isSorcerer: Player not found.")
		return false
	end

	return (isInArray({1,5}, getPlayerVocation(cid)) == TRUE)
end

function isDruid(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isDruid: Player not found.")
		return false
	end

	return (isInArray({2,6}, getPlayerVocation(cid)) == TRUE)
end

function isPaladin(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isPaladin: Player not found.")
		return false
	end

	return (isInArray({3,7}, getPlayerVocation(cid)) == TRUE)
end

function isKnight(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isKnight: Player not found.")
		return false
	end

	return (isInArray({4,8}, getPlayerVocation(cid)) == TRUE)
end

function isRookie(cid)
	if(isPlayer(cid) == FALSE) then
		debugPrint("isRookie: Player not found.")
		return false
	end

	return (isInArray({0}, getPlayerVocation(cid)) == TRUE)
end

function getDirectionTo(pos1, pos2)
	local dir = NORTH
	if(pos1.x > pos2.x) then
		dir = WEST
		if(pos1.y > pos2.y) then
			dir = NORTHWEST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHWEST
		end
	elseif(pos1.x < pos2.x) then
		dir = EAST
		if(pos1.y > pos2.y) then
			dir = NORTHEAST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHEAST
		end
	else
		if(pos1.y > pos2.y) then
			dir = NORTH
		elseif(pos1.y < pos2.y) then
			dir = SOUTH
		end
	end
	return dir
end

function getPlayerLookPos(cid)
	return getPosByDir(getThingPos(cid), getPlayerLookDir(cid))
end

function getPosByDir(fromPosition, direction, size)
	local n = size or 1

	local pos = fromPosition
	if(direction == NORTH) then
		pos.y = pos.y - n
	elseif(direction == SOUTH) then
		pos.y = pos.y + n
	elseif(direction == WEST) then
		pos.x = pos.x - n
	elseif(direction == EAST) then
		pos.x = pos.x + n
	elseif(direction == NORTHWEST) then
		pos.y = pos.y - n
		pos.x = pos.x - n
	elseif(direction == NORTHEAST) then
		pos.y = pos.y - n
		pos.x = pos.x + n
	elseif(direction == SOUTHWEST) then
		pos.y = pos.y + n
		pos.x = pos.x - n
	elseif(direction == SOUTHEAST) then
		pos.y = pos.y + n
		pos.x = pos.x + n
	end

	return pos
end

function getPlayerMoney(cid)
	return ((getPlayerItemCount(cid, ITEM_CRYSTAL_COIN) * 10000) + (getPlayerItemCount(cid, ITEM_PLATINUM_COIN) * 100) + getPlayerItemCount(cid, ITEM_GOLD_COIN))
end

function doPlayerWithdrawAllMoney(cid)
	return doPlayerWithdrawMoney(cid, getPlayerBalance(cid))
end

function doPlayerDepositAllMoney(cid)
	return doPlayerDepositMoney(cid, getPlayerMoney(cid))
end

function doPlayerTransferAllMoneyTo(cid, target)
	return doPlayerTransferMoneyTo(cid, target, getPlayerBalance(cid))
end

function playerExists(name)
	return getPlayerGUIDByName(name) ~= 0
end

function getTibiaTime()
	local minutes = getWorldTime()
	local hours = 0
	while (minutes > 60) do
		hours = hours + 1
		minutes = minutes - 60
	end

	return {hours = hours, minutes = minutes}
end

function doWriteLogFile(file, text)
	local file = io.open(file, "a+")
	file:write("[" .. os.date("%d/%m/%Y  %H:%M:%S") .. "] " .. text .. "\n")
	file:close()
end

function getExperienceForLevel(lv)
	lv = lv - 1
	return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end

function doMutePlayer(cid, time)
	local condition = createConditionObject(CONDITION_MUTED)
	setConditionParam(condition, CONDITION_PARAM_TICKS, time * 1000)
	return doAddCondition(cid, condition)
end

function getPlayerVocationName(cid)
	return getVocationInfo(getPlayerVocation(cid)).name
end

function getPromotedVocation(vid)
	return getVocationInfo(vid).promotedVocation
end

function doPlayerRemovePremiumDays(cid, days)
	return doPlayerAddPremiumDays(cid, -days)
end

function getPlayerMasterPos(cid)
	return getTownTemplePosition(getPlayerTown(cid))
end

function getItemNameById(itemid)
	return getItemDescriptionsById(itemid).name
end

function getItemPluralNameById(itemid)
	return getItemDescriptionsById(itemid).plural
end

function getItemArticleById(itemid)
	return getItemDescriptionsById(itemid).article
end

function getItemName(uid)
	return getItemDescriptions(uid).name
end

function getItemPluralName(uid)
	return getItemDescriptions(uid).plural
end

function getItemArticle(uid)
	return getItemDescriptions(uid).article
end

function getItemText(uid)
	return getItemDescriptions(uid).text
end

function getItemWriter(uid)
	return getItemDescriptions(uid).writer
end

function getItemDate(uid)
	return getItemDescriptions(uid).date
end

function getTilePzInfo(pos)
	return getTileInfo(pos).protection and TRUE or FALSE
end

function getTileZoneInfo(pos)
	local tmp = getTileInfo(pos)
	if(tmp.pvp) then
		return 2
	end

	if(tmp.nopvp) then
		return 1
	end

	return 0
end

function debugPrint(text)
	return io.stdout:write(text)
end

function doShutdown()
	return doSetGameState(GAMESTATE_SHUTDOWN)
end

function doSummonCreature(name, pos)
	local cid = doCreateMonster(name, pos)
	if(cid ~= LUA_ERROR) then
		return cid
	end

	cid = doCreateNpc(name, pos)
	return cid
end

function getOnlinePlayers()
	local tmp = getPlayersOnline()
	local players = {}
	for i, cid in ipairs(tmp) do
		table.insert(players, getCreatureName(cid))
	end

	return players
end

function getPlayerByName(name)
	local cid = getCreatureByName(name)
	return isPlayer(cid) == TRUE and cid or nil
end

function isPlayerGhost(cid)
	return isPlayer(cid) == TRUE and getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE) or FALSE
end

function doPlayerSetExperienceRate(cid, value)
	return doPlayerSetRate(cid, SKILL__LEVEL, value)
end

function doPlayerSetMagicRate(cid, value)
	return doPlayerSetRate(cid, SKILL__MAGLEVEL, value)
end

function getPlayerFrags(cid)
	return math.ceil((getPlayerRedSkullTicks(cid) / getConfigInfo('timeToDecreaseFrags')) + 1)
end

function getPartyLeader(cid)
	local party = getPartyMembers(cid)
	if(type(party) ~= 'table') then
		return 0
	end

	return party[1]
end

function isInParty(cid)
	return type(getPartyMembers(cid)) == 'table' and TRUE or FALSE
end

function isPrivateChannel(channelId)
	for i = CHANNEL_GUILD, CHANNEL_HELP do
		if(channelId == i) then
			return FALSE
		end
	end

	return TRUE
end

function doConvertIntegerToIp(int, mask)
	local b4 = bit.urshift(bit.uband(int, 4278190080), 24)
	local b3 = bit.urshift(bit.uband(int, 16711680), 16)
	local b2 = bit.urshift(bit.uband(int, 65280), 8)
	local b1 = bit.urshift(bit.uband(int, 255), 0)
	if(mask ~= nil) then
		local m4 = bit.urshift(bit.uband(mask,  4278190080), 24)
		local m3 = bit.urshift(bit.uband(mask,  16711680), 16)
		local m2 = bit.urshift(bit.uband(mask,  65280), 8)
		local m1 = bit.urshift(bit.uband(mask,  255), 0)
		if((m1 == 255 or m1 == 0) and (m2 == 255 or m2 == 0) and (m3 == 255 or m3 == 0) and (m4 == 255 or m4 == 0)) then
			if m1 == 0 then b1 = "x" end
			if m2 == 0 then b2 = "x" end
			if m3 == 0 then b3 = "x" end
			if m4 == 0 then b4 = "x" end
		elseif(m1 ~= 255 or m2 ~= 255 or m3 ~= 255 or m4 ~= 255) then
			return b1 .. "." .. b2 .. "." .. b3 .. "." .. b4 .. " : " .. m1 .. "." .. m2 .. "." .. m3 .. "." .. m4
		end
	end
	
	return b1 .. "." .. b2 .. "." .. b3 .. "." .. b4
end

function doConvertIpToInteger(str)
	local maskindex = str:find(":")
	if(maskindex == nil) then
		local ipint = 0
		local maskint = 0

		local index = 24		
		for b in str:gmatch("([x%d]+)%.?") do
			if(b ~= "x") then
				if(b:find("x") ~= nil) then
					return 0, 0
				end

				if(tonumber(b) > 255 or tonumber(b) < 0) then
					return 0, 0
				end

				maskint = bit.ubor(maskint, bit.ulshift(255, index))
				ipint = bit.ubor(ipint, bit.ulshift(b, index))
			end

			index = index - 8
			if(index < 0) then
				break
			end
		end

		if(index ~= -8) then
			return 0, 0
		end

		return ipint, maskint
	end

	if(maskindex <= 1) then
		return 0, 0
	end

	local ipstring = str:sub(1, maskindex - 1)
	local maskstring = str:sub(maskindex)
			
	local ipint = 0
	local maskint = 0
			
	local index = 0
	for b in ipstring:gmatch("(%d+).?") do
		if(tonumber(b) > 255 or tonumber(b) < 0) then
			return 0, 0
		end

		ipint = bit.ubor(ipint, bit.ulshift(b, index))
		index = index + 8
		if(index > 24) then
			break
		end
	end

	if(index ~= 32) then
		return 0, 0
	end
			
	index = 0
	for b in maskstring:gmatch("(%d+)%.?") do
		if(tonumber(b) > 255 or tonumber(b) < 0) then
			return 0, 0
		end

		maskint = bit.ubor(maskint, bit.ulshift(b, index))
		index = index + 8
		if(index > 24) then
			break
		end
	end

	if(index ~= 32) then
		return 0, 0
	end
			
	return ipint, maskint
end

function getBooleanFromString(str)
	return (str:lower() == "yes" or str:lower() == "true" or (tonumber(str) and tonumber(str) > 0)) and TRUE or FALSE
end

function doCopyItem(item, attributes)
	local attributes = attributes or FALSE

	local ret = doCreateItemEx(item.itemid, item.type)
	if(attributes == TRUE) then
		if(item.actionid > 0) then
			doSetItemActionId(ret, item.actionid)
		end
	end

	if(isContainer(item.uid) == TRUE) then
		for i = (getContainerSize(item.uid) - 1), 0, -1 do
			local tmp = getContainerItem(item.uid, i)
			if(tmp.itemid > 0) then
				doAddContainerItemEx(ret, doCopyItem(tmp, TRUE).uid)
			end
		end
	end

	return getThing(ret)
end

table.find = function (table, value)
	for i, v in pairs(table) do
		if(v == value) then
			return i
		end
	end

	return nil
end

table.isStrIn = function (txt, str)
	for i, v in pairs(str) do
		if(txt:find(v) and not txt:find('(%w+)' .. v) and not txt:find(v .. '(%w+)')) then
			return true
		end
	end

	return false
end

table.countElements = function (table, item)
	local count = 0
	for i, n in pairs(table) do
		if(item == n) then
			count = count + 1
		end
	end

	return count
end

table.getCombinations = function (table, num)
	local a, number, select, newlist = {}, #table, num, {}
	for i = 1, select do
		a[#a + 1] = i
	end

	local newthing = {}
	while(true) do
		local newrow = {}
		for i = 1, select do
			newrow[#newrow + 1] = table[a[i]]
		end

		newlist[#newlist + 1] = newrow
		i = select
		while(a[i] == (number - select + i)) do
			i = i - 1
		end

		if(i < 1) then
			break
		end

		a[i] = a[i] + 1
		for j = i, select do
			a[j] = a[i] + j - i
		end
	end

	return newlist
end

string.split = function (str)
	local t = {}
	local function helper(word)
		table.insert(t, word)
		return ""
	end

	if(not str:gsub("%w+", helper):find("%S")) then
		return t
	end
end

string.trim = function (str)
	return (string.gsub(str, "^%s*(.-)%s*$", "%1"))
end

string.explode = function (str, sep)
	local pos, t = 1, {}
	if #sep == 0 or #str == 0 then
		return
	end

	for s, e in function() return str:find(sep, pos) end do
		table.insert(t, str:sub(pos, s - 1):trim())
		pos = e + 1
	end

	table.insert(t, str:sub(pos):trim())
	return t
end
  function doKillCreature(cid, time, lastHitKiller, mostDamageKiller)

local config = {
        deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
        sqlType = getConfigInfo('sqlType'),
        maxDeathRecords = getConfigInfo('maxDeathRecords')
}

        config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

        if(config.deathListEnabled ~= TRUE) then
                return
        end

        if(not time) or (time == 0) or (not isNumber(time)) then
                doCreatureAddHealth(cid, - getCreatureHealth(cid))
        end

        addEvent(doCreatureAddHealth, time * 1000, cid, - getCreatureHealth(cid))

        local hitKillerName = lastHitKiller
        if(not lastHitKiller) then
                hitKillerName = "field item"
        end

        local lastKillerName = mostDamageKiller
        if(not mostDamageKiller) then
                lastKillerName = ""
        end

        db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(lastKillerName) .. ");")
        local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
        if(rows:getID() ~= -1) then
                local amount = rows:getRows(true) - config.maxDeathRecords
                if(amount > 0) then
                        if(config.sqlType == DATABASE_ENGINE_SQLITE) then
                                for i = 1, amount do
                                        db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
                                end
                        else
                                db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
                        end
                end
        end

        return LUA_ERROR
end
function isWalkable(cid,pos)
    local aux = pos
    aux.stackpos = 253
    if doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(aux).uid) == FALSE then
        return TRUE
    end
    return FALSE
end
function getWeaponDistanceEffect(uid)
    local WeaponType = getItemWeaponType(uid)
    if WeaponType == WEAPON_CLUB then
        return CONST_ANI_WHIRLWINDCLUB
    elseif WeaponType == WEAPON_SWORD then
        return CONST_ANI_WHIRLWINDSWORD
    elseif WeaponType == WEAPON_AXE then
        return CONST_ANI_WHIRLWINDAXE
    else
        return CONST_ANI_NONE
    end
end 

function isWalkable(cid,pos)
    local aux = pos
    aux.stackpos = 253
    if doTileQueryAdd(cid, pos) == 1 and getTilePzInfo(pos) == FALSE and isCreature(getThingFromPos(aux).uid) == FALSE then
        return TRUE
    end
    return FALSE
end

function getWeaponDistanceEffect(uid) 
    local WeaponType = getItemWeaponType(uid) 
    if WeaponType == WEAPON_CLUB then 
        return CONST_ANI_WHIRLWINDCLUB 
    elseif WeaponType == WEAPON_SWORD then 
        return CONST_ANI_WHIRLWINDSWORD 
    elseif WeaponType == WEAPON_AXE then 
        return CONST_ANI_WHIRLWINDAXE 
    else 
        return CONST_ANI_NONE 
    end 
end

function getOppositeSidePos(cid,centerPos)
    local otherSideDirTable = {                                              
        {SOUTH,SOUTHWEST,SOUTHEAST},  --NORTH
        {WEST,SOUTHWEST,NORTHWEST},   --EAST
        {NORTH,NORTHWEST,NORTHEAST},     --SOUTH
        {EAST,SOUTHEAST,NORTHEAST},   --WEST
        {NORTH,EAST,NORTHEAST},       --SOUTHWEST
        {NORTH,WEST,NORTHWEST},       --SOUTHEAST
        {SOUTH,EAST,SOUTHEAST},       --NORTHWEST
        {SOUTH,WEST,SOUTHWEST}        --NORTHEAST
    }   
    local PlayerDirection = (getDirectionTo(centerPos,getCreaturePosition(cid)))+1
    local newDirection = otherSideDirTable[PlayerDirection][math.random(1,3)]
    local newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,getPosByDir(centerPos,newPos)) then
        return newPos
    end
    if newDirection == 1 then
        local rand = math.random(2,3)
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][5-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    elseif newDirection == 2 then
        local rand = math.random(1,2)
        if rand == 2 then rand = 3 end
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][4-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    elseif newDirection == 3 then
        local rand = math.random(1,2)
        newDirection = otherSideDirTable[PlayerDirection][rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
        newDirection = otherSideDirTable[PlayerDirection][3-rand]
        newPos = getPosByDir(centerPos,newDirection)
        if isWalkable(cid,newPos) then
            return newPos
        end
    end
    otherSideDirTable = {
        {EAST,WEST},                    --NORTH     
        {NORTH,SOUTH},                  --EAST      
        {EAST,WEST},                    --SOUTH     
        {NORTH,SOUTH},                  --WEST      
        {SOUTHEAST,NORTHWEST},          --SOUTHWEST 
        {SOUTHWEST,NORTHEAST},          --SOUTHEAST 
        {SOUTHWEST,NORTHEAST},          --NORTHWEST 
        {SOUTHEAST,NORTHWEST}           --NORTHEAST 
    }
    local rand = math.random(1,2)
    newDirection = otherSideDirTable[PlayerDirection][rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    newDirection = otherSideDirTable[PlayerDirection][3-rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    otherSideDirTable = {
        {NORTHWEST,NORTHEAST},                    --NORTH     
        {SOUTHEAST,NORTHEAST},                    --EAST      
        {SOUTHWEST,SOUTHEAST},                    --SOUTH     
        {SOUTHWEST,NORTHWEST},                    --WEST      
        {SOUTH,WEST},                             --SOUTHWEST 
        {EAST,SOUTH},                             --SOUTHEAST 
        {NORTH,WEST},                             --NORTHWEST 
        {NORTH,EAST}                              --NORTHEAST 
    }
    local rand = math.random(1,2)
    newDirection = otherSideDirTable[PlayerDirection][math.random(1,2)]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    newDirection = otherSideDirTable[PlayerDirection][3-rand]
    newPos = getPosByDir(centerPos,newDirection)
    if isWalkable(cid,newPos) then
        return newPos
    end
    return getPosByDir(centerPos,PlayerDirection-1)
end

I'll try... again xD I wasn't want to because that.. i lose alot of thinks, i have months with my OT so i made lot of things in that time i don't want to lose them xD

Thanks ^^
 
Nonono, luafunctions, in /doc/luafunctions, open it with wordpad.

Also; you don't really have to lose what you've done.

Just move it. And if it's because of the database, keep it.
 
Ok sorry..

I have 3 lua function

LUA_FUNCTION

Code:
[ LUA FUNCTIONS
	Project Name
		The Forgotten Server

	Version
		0.3 Beta 3

	Codenamed
		\

	License
		GNU GPLv3

	Forum
		http://otland.net/
]

[ ABOUT
	List with all Lua functions available.
	You can read a short instructions for all the functions;
		how to use, what it returns and an usage example.
]

[ "get" functions
	Introduction
		These functions will return a requested string or value.

	LIST
		getPlayerFood(cid)
			Info
				This function will check how many seconds a player is full.

			Returns
				Time in second for which player is full: 360.
					Ham - 360, Meat - 180, Fish - 145

		getCreatureHealth(cid)
			Info
				This function will check for creatures health points.

			Returns
				Creatures current health points.

		getCreatureMaxHealth(cid)
			Info
				This function will check for creatures max health points.

			Returns
				Creatures max health points.

		getCreatureMana(cid)
			Info
				This function will check for creatures mana points.

			Returns
				Creatures current mana points.

		getCreatureMaxMana(cid)
			Info
				This function will check for creatures max mana points.

			Returns
				Creatures max mana points.

		getPlayerLevel(cid)
			Info
				This function will check for players current level.

			Returns
				Players current level.

		getPlayerMagLevel(cid)
			Info
				This function will check for players current magic level.

			Returns
				Players current magic level.

		getCreatureName(cid)
			Info
				This function will check for creature name.

			Returns
				Creature name.

		getPlayerAccess(cid)
			Info
				This function will check for players access.

			Returns
				Players access.

		getCreaturePosition(cid)
			Info
				This function will check for current creature position.

			Returns
				Position in array
					Example
						{x = 127, y = 7, z = 9, stackpos = 1}
						{x = 396, y = 582, z = 13, stackpos = 2} (when creature is on an item)

			Example
				local cPos = getCreaturePosition(cid)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your current position is [X: "..cPos.x.." | Y: "..cPos.y.." | Z: "..cPos.z.."].")

		getPlayerSkillLevel(cid, skillid)
			Info
				This function will check for player actually position.
					Skillid can be:
						0 = Fist Fighting
						1 = Club Fighting
						2 = Sword Fighting
						3 = Axe Fighting
						4 = Distance Fighting
						5 = Shielding
						5 = Fishing

			Returns
				Player skill value.
					For Example
						37
						10

			Example
				if getPlayerSkillLevel(cid, 2) >= 20 then --Checking for sword skill value
					doPlayerAddItem(cid, 2376, 1) --give sword, when skill >= 20
				else
					doPlayerSendCancel(cid, "Sorry, your sword skill is not high enough.")
				end

		getPlayerTown(cid)
			Info
				This function will check player actually Town ID.

			Returns
				Player Town ID.
					For Example:
						1
						3

			Example
				local playerPos = getCreaturePosition(cid)
				if getPlayerTown(cid) == 1 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 1 (Main City)! :)', TEXTCOLOR_GOLD)
				elseif getPlayerTown(cid) == 2 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 2 (Desert City)! :)', TEXTCOLOR_GOLD)
				end

		getPlayerVocation(cid)
			Info
				This function will check player Vocation ID.

			Returns
				Player Vocation ID.
					For Example:
						1 - when player vocation is Sorcerer
						7 - when player vocation is Royal Paladin

			Example
				local playerVoc = getPlayerVocation(cid)
					if playerVoc == 1 or playerVoc == 5 then --If Vocation is Sorcerer or Master Sorcerer then weapon = Wand
						weapon == 2190 --Wand of vortex
					elseif playerVoc == 2 or playerVoc == 6 then --If Voc == Druid or Elder Druid then weapon = Rod
						weapon == 2182 --Snakebite Rod
					elseif playerVoc == 3 or playerVoc == 7 then --If Voc == Paladin or Royal Paladin then weapon = Spear
						weapon == 2389 --Spear
					elseif playerVoc == 4 or playerVoc == 8 then --If Voc == Knight or Elite Knight then weapon = Sword
						weapon == 2412 --Katana
					end
				doPlayerAddItem(cid, weapon, 1)

		getPlayerItemCount(cid,itemid)
			Info
				This function will check how much items with == itemid player actually have.

			Returns
				Count of itemid.
					For Example:
						2 - when player have 2x royal spear
						189 - when player have 189 platinum coins

			Example
				local crystalCoins = getPlayerItemCount(cid, 2160)
				local platinumCoins = getPlayerItemCount(cid, 2152)
				local goldCoins = getPlayerItemCount(cid, 2148)
					money = crystalCoins * 10000 + platinumCoins * 100 + goldCoins
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your money: " ..money.. "gp")

		getPlayerSoul(cid)
			Info
				This function will check how much soul points player actually have.

			Returns
				Player actually soul points.
					For Example:
						27 - when player have 27 soul points
						134 - when player have 134 soul points

			Example
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your soul points: " ..getPlayerSoul(cid))

		getPlayerFreeCap(cid)
			Info
				This function will check how much free cap points player actually have.

			Returns
				Player actually cap points.
					For Example:
						181 - when player have 181 capacity
						1460 - when player have 1460 capacity

			Example
				local playerCap = getPlayerFreeCap(cid)
				local item = 2393 --Giant Sword
				local itemweight = getItemWeight(item, 1)
					if playerCap >= itemweight then
						doPlayerSendTextMessage(cid,22,'You have found a giant sword.')
						doPlayerAddItem(cid,item,1)
					else
						doPlayerSendTextMessage(cid, 22, 'You have found a giant sword weighing ' ..itemweight.. ' oz it\'s too heavy.')

		getPlayerLight(cid)
			Info
				This function will check for player actually light.

			Returns
				Player actually light.
					For Example:
						215 - after using "utevo gran lux"

		getPlayerSlotItem(cid, slot)
			Info
				This function will check what item player have actually in slot.
					Skillid can be:
						1 = helmet
						2 = necklace slot (amulet of loss etc.)
						3 = backpack, bag
						4 = armor
						5 = left hand (its really hand placed >> (right page on screen))
						6 = right hand (its really hand placed << (left page on screen))
						7 = legs
						8 = boots
						9 = ring slot
						10 = ammo slot (arrows etc.)

			Returns
				Array with item which is actually in slot. When slot is empty, then return = 0 (FALSE)
					For Example:
						{itemid = 2493, uid = 70001, actionid = 0} (demon helmet, slot = 1)

			Example
				if getPlayerSlotItem(cid, 2) == 2173 then  --checking for amulet of loss
					doPlayerSendTextMessage(cid,22,'Ok, you can go.')
				else
					doPlayerSendTextMessage(cid,22,'Sorry, you need amulet of loss to go.')
					doTeleportThing(cid, fromPosition, TRUE)
				end

		getPlayerDepotItems(cid, depotid)
			Info
				This function will check how much items (slots reserved, becouse 10cc = 1 slot) player have in depo.
					Depotid = number, which depo we want to check.

			Returns
				Busy slots in depot.
					For example:
						7 - when player have in depo:
							- sword
							- rope
							- 100 uh
							- parcel (inside: 10 crystal coins + label)
							- depot chest (standard, all players have it)

			Example
				depotItems = getPlayerDepotItems(cid, 3)  -- 3 = Desert City
				if depotItems < 2 then --When depo contains only 1 ITEM.
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains 1 item.")
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains " ..depotItems.. " items.")
				end


		getPlayerSex(cid)
			Info
				This function will check player sex.

			Returns
				Player sex.
					For example:
						0 - when player is female
						1 - when player is male

			Example
				if getPlayerSex(cid) then --when female
					doSendAnimatedText(playerPos, 'GiRl :*:*', TEXTCOLOR_GOLD)
				elseif getPlayerSex(cid) then --male
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				else -- dont know how it is in english, but in polish = obojniak - something between boy and girl :P
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				end

		getPlayerLookDir(cid)
			Info
				This function will check player direction.

			Returns
				Player direction.
					For example:
						0 - player is looking up (north) (/\)
						1 - player is looking right (east) (>)
						2 - player is looking down (south) (\/)
						3 - player is looking left (west) (<)

			Example
				local direction = getPlayerLookDir(cid)
				if direction = 0 then --when north
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to north")
				elseif direction = 1 then --when east
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to east")
				elseif direction = 2 then --when south
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to south")
				else --when west
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to west")
				end

		getPlayerGUID(cid)
			Info
				This function will check for player id.

			Returns
				Player id. When checked creature isn't player then return = -1
					For example:
						61 - when player id in database is 61
						-1 - when checked creature is NPC

			Example
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are player with id: "..getPlayerGUID(cid))

		getPlayerFlagValue(cid, flag)
			Info
				This function will check player flag value.
			Returns
				Return flag value. 1 = when true (player have this flag), 0 = when false (havent)
					For example:
						1 - checking GM for flag 8 (Can not be attacked)
						0 - checking player for flag 8 (Can not be attacked)

			Example
				flagValue = getPlayerFlagValue(cid, 32) --32 "Can summon all monsters"
					if flagValue = 1 then --if can
						doSummonCreature("Demon", fromPosition.x + 1)
					else --if cant
						doSummonCreature("Rat", fromPosition.x + 1)
					end

		getPlayerGroupId(cid)
			Info
				This function will check player group ID.

			Returns
				Player group id.
					For example (using standard TFS groups):
						1 - when checked player is player
						2 - when checked player is gamemaster
						3 - when checked player is god

			Example
				local group = getPlayerGroupId(cid)
					if group == 3 --when God
						doPlayerAddItem(cid,2160,100) --100 crystal coins
					elseif group == 2 --when Gamemaster
						doPlayerAddItem(cid,2160,50) --50 crystal coins
					else
						doPlayerSendCancel(cid, "Sorry, cheats doesnt work for you."
					end

		getPlayerGuildId(cid)
			Info
				This function will return the players guild id.

			Returns
				Players guild id.
					For example
						21 - The guild the player is in has the guild id 21, as stored in the database.

			Example
				local guildId = getPlayerGuildId(cid)
					if guildId == 21 then
						doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Welcome in!")
					elseif guildId == 22 then
						doPlayerSendCancel(cid,"This area is not for your guild")
					end

		getPlayerGuildName(cid)
			Info
				Used to get a players guild name.

			Returns
				Players guild name in a string.
					For example
						"Lost Dragons"

			Example
				local guildName = getPlayerGuildName(cid)
				doSendAnimatedText(getCreaturePosition(cid),guildName, TEXTCOLOR_GOLD)

		getPlayerGuildRank(cid)
			Info
				Used to get a players rank name in a guild.

			Returns
				The players current rank in his guild in a string
					For example
						"Senator"

			Example
				local rank = getPlayerGuildRank(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You're a " .. rank .. " in your guild.")

		getPlayerGuildNick(cid)
			Info
				Used to get a players nick in his guild.

			Returns
				The players current nick in a string.
					For example
						"The protector"

			Example
				local guildNick = getPlayerGuildNick(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your guild nick is " .. guildNick .. ".")
]

[ "do" functions
	Introduction
		These functions usually execute an action.

	List
		doPlayerSendCancel(cid, text)
			Info
				This function will send default cancel message do player (visible in bottom of

			Returns
				Return 1 (TRUE) - when msg was sent, 0 - when it was impossible (FALSE)

			Example
				if getPlayerLevel(cid) >= 10 then --checking level
					doSummonCreature("Chicken", fromPosition.x + 1)
				else
					doPlayerSendCancel(cid, "Sorry, your level isnt enought to summon this monster."
				end
]

[ LIST
	//get*
	getCreatureHealth(cid)
	getCreatureMaxHealth(cid)
	getCreatureMana(cid)
	getCreatureMaxMana(cid)
	getCreatureMaster(cid)
	getCreatureSummons(cid)
	getCreatureOutfit(cid)
	getCreaturePosition(cid)
	getCreatureName(cid)
	getCreatureSpeed(cid)
	getCreatureBaseSpeed(cid)
	getCreatureTarget(cid)
	getCreatureByName(name)
	getCreatureSkullType(cid)
	getCreatureCondition(cid, condition)
	getMonsterTargetList(cid)
	getMonsterFriendList(cid)
	getPlayerByNameWildcard(name~)
	getPlayerLossSkill(cid)
	getPlayerLossPercent(cid, lossType)
	getPlayerGUIDByName(name)
	getPlayerNameByGUID(guid)
	getPlayerFood(cid)
	getPlayerLevel(cid)
	getPlayerExperience(cid)
	getPlayerMagLevel(cid)
	getPlayerSpentMana(cid)
	getPlayerAccess(cid)
	getPlayerSkillLevel(cid, skillid)
	getPlayerSkillTries(cid, skillid)
	getPlayerTown(cid)
	getPlayerVocation(cid)
	getPlayerRequiredMana(cid, magicLevel)
	getPlayerRequiredSkillTries(cid, skillId, skillLevel)
	getPlayerItemCount(cid, itemid)
	getPlayerSoul(cid)
	getPlayerAccountId(cid)
	getPlayerAccount(cid)
	getPlayerIp(cid)
	getPlayerFreeCap(cid)
	getPlayerLight(cid)
	getPlayerSlotItem(cid, slot)
	getPlayerWeapon(cid[, ignoreAmmo])
	getPlayerItemById(cid, deepSearch, itemId[, subType])
	getPlayerDepotItems(cid, depotid)
	getPlayerGuildId(cid)
	getPlayerGuildName(cid)
	getPlayerGuildRank(cid)
	getPlayerGuildNick(cid)
	getPlayerGuildLevel(cid)
	getPlayerSex(cid)
	getPlayerLookDir(cid)
	getPlayerStorageValue(uid, valueid)
	getPlayerGUID(cid)
	getPlayerFlagValue(cid, flag)
	getPlayerCustomFlagValue(cid, flag)
	getPlayerPromotionLevel(cid)
	getPlayerGroupId(cid)
	getPlayerLearnedInstantSpell(cid, name)
	getPlayerInstantSpellCount(cid)
	getPlayerInstantSpellInfo(cid, index)
	getPlayerSex(cid)
	getPlayerBlessing(cid, blessing)
	getPlayerStamina(cid)
	getPlayerNoMove(cid)
	getPlayerExtraExpRate(cid)
	getPlayerPartner(cid)
	getPlayerParty(cid)
	getPlayerPremiumDays(cid)
	getPlayerBalance(cid)
	getPlayerRedSkullTicks(cid)
	getInstantSpellInfoByName(cid, name)
	getInstantSpellWords(name)
	getPlayersByAccountId(accountNumber)
	getPlayersByIp(ip[, mask = 0xFFFFFFFF])
	getPlayersOnline()
	getPartyMembers(lid)
	getAccountIdByName(name)
	getAccountByName(name)
	getAccountIdByAccount(accName)
	getIpByName(name)
	getItemRWInfo(uid)
	getItemDescriptionsById(itemid)
	getItemNameById(itemid)
	getItemPluralNameById(itemid)
	getItemArticleById(itemid)
	getItemWeightById(itemid, count[, precise])
	getItemDescriptions(uid)
	getItemName(uid)
	getItemPluralName(uid)
	getItemArticle(uid)
	getItemWeight(uid[, precise])
	getItemAttack(uid)
	getItemExtraAttack(uid)
	getItemDefense(uid)
	getItemExtraDefense(uid)
	getItemArmor(uid)
	getItemAttackSpeed(uid)
	getItemHitChance(uid)
	getItemIdByName(name)
	getFluidSourceType(type)
	getContainerSize(uid)
	getContainerCap(uid)
	getContainerCapById(itemid)
	getContainerItem(uid, slot)
	getDepotId(uid)
	getTileItemById(pos, itemId[, subType])
	getTileItemByType(pos, type)
	getTileThingByPos(pos)
	getTilePzInfo(pos)
	getTileHouseInfo(pos)
	getTopCreature(pos)
	getClosestFreeTile(cid, targetpos[, extended[, ignoreHouse]])
	getThingFromPos(pos)
	getThing(uid)
	getThingPos(uid)
	getHouseOwner(houseid)
	getHouseName(houseid)
	getHouseEntry(houseid)
	getHouseRent(houseid)
	getHousePrice(houseid)
	getHouseTown(houseid)
	getHouseAccessList(houseid, listid)
	getHouseByPlayerGUID(playerGUID)
	getHouseTilesSize(houseid)
	getTownId(townName)
	getTownName(townId)
	getTownTemplePosition(townId)
	getTownHouses(townId)
	getWorldType()
	getWorldTime()
	getWorldLight()
	getWorldCreatures(type) //0 players, 1 monsters, 2 npcs, 3 all
	getWorldUpTime()
	getHighscoreString(skillId)
	getVocationInfo(id)
	getGuildId(guildName)
	getSpectators(centerPos, rangex, rangey, multifloor)
	getSearchString(fromPosition, toPosition[, isPlayer])
	getNotationsCound(accId)
	getBanData(value)
	getBanList(type[, value])
	getBanReason(id)
	getBanAction(id[, ipBanishment])
	getGlobalStorageValue(valueid)
	getConfigFile()
	getLogsDir()
	getDataDir()

	//set*
	setCreatureMaxHealth(cid, health)
	setCreatureMaxMana(cid, mana)
	setPlayerStorageValue(uid, valueid, newvalue)
	setPlayerGroupId(cid, newGroupId)
	setPlayerPromotionLevel(cid, level)
	setPlayerStamina(cid, minutes)
	setPlayerExtraExpRate(cid, value)
	setPlayerPartner(cid, guid)
	setHouseOwner(houseid, ownerGUID)
	setHouseAccessList(houseid, listid, listtext)
	setItemName(uid)
	setItemPluralName(uid)
	setItemIdArticle(uid)
	setItemAttack(uid, attack)
	setItemExtraAttack(uid, extraattack)
	setItemDefense(uid, defense)
	setItemArmor(uid, armor)
	setItemExtraDefense(uid, extradefense)
	setItemAttackSpeed(uid, attackspeed)
	setItemHitChance(uid, hitChance)
	setCombatArea(combat, area)
	setCombatCondition(combat, condition)
	setCombatParam(combat, key, value)
	setConditionParam(condition, key, value)
	setCombatCallBack(combat, key, function_name)
	setCombatFormula(combat, type, mina, minb, maxa, maxb)
	setConditionFormula(combat, mina, minb, maxa, maxb)
	setGlobalStorageValue(valueid, newvalue)
	setWorldType(type)

	//do*
	doCreatureAddHealth(cid, health[, force])
	doCreatureAddMana(cid, mana)
	doCreatureSetDropLoot(cid, doDrop)
	doCreatureSetSkullType(cid, skull)
	doCreatureChangeOutfit(cid, outfit)
	doCreatureSay(cid, text, type[, pos])
	doSetCreatureLight(cid, lightLevel, lightColor, time)
	doSetCreatureOutfit(cid, outfit, time)
	doRemoveCreature(cid)
	doMoveCreature(cid, direction)
	doSummonCreature(name, pos)
	doConvinceCreature(cid, target)
	doChallengeCreature(cid, target)
	doChangeSpeed(cid, delta)
	doMonsterChangeTarget(cid)
	doMonsterSetTarget(cid, target)
	doSetMonsterOutfit(cid, name, time)
	doPlayerBroadcastMessage(cid, message[, type])
	doPlayerSetSex(cid, newSex)
	doPlayerSetTown(cid, townid)
	doPlayerSetVocation(cid,voc)
	doPlayerRemoveItem(cid, itemid, count[, subtype])
	doPlayerAddExp(cid, exp)
	doPlayerSetGuildId(cid, id)
	doPlayerSetGuildRank(cid, rank)
	doPlayerSetGuildNick(cid, nick)
	doPlayerAddOutfit(cid,looktype, addons)
	doPlayerRemoveOutfit(cid,looktype, addons)
	doPlayerSetRedSkullTicks(cid, amount)
	doPlayerSetLossPercent(cid, lossType, newPercent)
	doPlayerSetLossSkill(cid, doLose)
	doPlayerAddSkillTry(cid, skillid, n)
	doPlayerAddSpentMana(cid, amount)
	doPlayerAddSoul(cid, soul)
	doPlayerAddItem(uid, itemid[, count/subtype[, canDropOnMap]])
	doPlayerAddItemEx(cid, uid[, canDropOnMap])
	doPlayerSendTextMessage(cid, MessageClasses, message)
	doPlayerAddMoney(cid, money)
	doPlayerRemoveMoney(cid, money)
	doPlayerWithdrawMoney(cid, money)
	doPlayerDepositMoney(cid, money)
	doPlayerTransferMoneyTo(cid, target, money)
	doPlayerPopupFYI(cid, message)
	doPlayerSendTutorial(cid, id)
	doPlayerAddMapMark(cid, pos, type[, description])
	doPlayerAddPremiumDays(cid, days)
	doPlayerAddBlessing(cid, blessing)
	doPlayerAddStamina(cid, minutes)
	doPlayerSetNoMove(cid, cannotMove)
	doPlayerResetIdleTime(cid)
	doPlayerLearnInstantSpell(cid, name)
	doPlayerFeed(cid, food)
	doPlayerSendCancel(cid, text)
	doPlayerSendDefaultCancel(cid, ReturnValue)
	doCreateItem(itemid, type/count, pos)
	doCreateItemEx(itemid[, count/subtype])
	doAddContainerItemEx(uid, virtuid)
	doAddContainerItem(uid, itemid[, count/subtype])
	doChangeTypeItem(uid, newtype)
	doDecayItem(uid)
	doRemoveItem(uid[, n])
	doTransformItem(uid, toitemid[, count/subtype])
	doSetItemActionId(uid, actionid)
	doSetItemText(uid, text)
	doSetItemSpecialDescription(uid, desc)
	doSetItemOutfit(cid, item, time)
	doTileAddItemEx(pos, uid)
	doAddCondition(cid, condition)
	doRemoveCondition(cid, type)
	doAreaCombatHealth(cid, type, pos, area, min, max, effect)
	doTargetCombatHealth(cid, target, type, min, max, effect)
	doAreaCombatMana(cid, pos, area, min, max, effect)
	doTargetCombatMana(cid, target, min, max, effect)
	doAreaCombatCondition(cid, pos, area, condition, effect)
	doTargetCombatCondition(cid, target, condition, effect)
	doAreaCombatDispel(cid, pos, area, type, effect)
	doTargetCombatDispel(cid, target, type, effect)
	doCombat(cid, combat, param)
	doTeleportThing(cid, newpos[, pushmove])
	doCreateTeleport(itemid, topos, createpos)
	doSendMagicEffect(pos, type[, creature])
	doSendDistanceShoot(frompos, topos, type[, creature])
	doSendAnimatedText(pos, text, color[, creature])
	doShowTextDialog(cid, itemid, text)
	doRelocate(pos, posTo)
	doBroadcastMessage(message, type)
	doAddIpBanishment(ip[, length[, comment[, admin]]])
	doAddNamelock(name[, reason[, action[, comment[, admin]]]])
	doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])
	doAddDeletion(accId[, reason[, action[, comment[, admin]]]]])
	doAddNotation(accId[, reason[, action[, comment[, admin]]]]])
	doRemoveIpBanishment(ip[, mask])
	doRemoveNamelock(name)
	doRemoveBanisment(accId)
	doRemoveDeletion(accId)
	doRemoveNotations(accId)


	//is*
	isCreature(cid)
	isMonster(uid)
	isNpc(uid)
	isPlayer(cid)
	isPlayerPzLocked(cid)
	isPlayerGhost(cid)
	isItemStackable(itemid)
	isItemRune(itemid)
	isItemDoor(itemid)
	isItemLevelDoor(itemid)
	isItemContainer(itemid)
	isItemFluidContainer(itemid)
	isItemMovable(itemid)
	isContainer(uid)
	isCorpse(uid)
	isMovable(uid)
	isSightClear(fromPos, toPos, floorCheck)
	isIpBanished(ip[, mask])
	isPlayerNamelocked(name)
	isAccountBanished(accId)
	isAccountDeleted(accId)
	isInArray({array}, value)

	//others
	registerCreatureEvent(uid, eventName)
	createCombatArea({area}[, {exArea}])
	createConditionObject(type)
	addDamageCondition(condition, rounds, time, value)
	addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
	createCombatObject()
	numberToVariant(number)
	stringToVariant(string)
	positionToVariant(pos)
	targetPositionToVariant(pos)
	variantToNumber(var)
	variantToString(var)
	variantToPosition(var)
	canPlayerLearnInstantSpell(cid, name)
	queryTileAddThing(uid, pos[, flags])
	canPlayerWearOutfit(cid, looktype, addons)
	executeRaid(name)
	saveServer()
	cleanHouse(houseId)
	cleanMap()
	shutdown()
	addEvent(callback, delay, ...)
	stopEvent(eventid)
	debugPrint(text)
	hasProperty(uid)

	//db table
	db.executeQuery(query)
	db.storeQuery(query)
	db.escapeString(str)
	db.escapeBlob(s, length)
	db.stringComparisonOperator()

	//result table
	result.getDataInt(resId, s)
	result.getDataLong(resId, s)
	result.getDataString(resId, s)
	result.getDataStream(resId, s, length)
	result.next(resId)
	result.free(resId)

	//bit table
	#bit.cast
	bit.bnot(n)
	bit.band(type, n)
	bit.bor(type, n)
	bit.bxor(type, n)
	bit.lshift(type, n)
	bit.rshift(type, n)
	#bit.arshift
	#bit.ucast
	bit.ubnot(n)
	bit.uband(type, n)
	bit.ubor(type, n)
	bit.ubxor(type, n)
	bit.ulshift(type, n)
	bit.urshift(type, n)
	#bit.uarshift

	//compats
	table.getPos = table.find
	doSetCreatureDropLoot = doCreatureSetDropLoot
	doPlayerSay = doCreatureSay
	doPlayerAddMana = doCreatureAddMana
	playerLearnInstantSpell = doPlayerLearnInstantSpell
	doPlayerRemOutfit = doPlayerRemoveOutfit
	pay = doPlayerRemoveMoney
	broadcastMessage = doBroadcastMessage
	getPlayerName = getCreatureName
	getPlayerPosition = getCreaturePosition
	getCreaturePos = getCreaturePosition
	creatureGetPosition = getCreaturePosition
	getPlayerMana = getCreatureMana
	getPlayerMaxMana = getCreatureMaxMana
	hasCondition = getCreatureCondition
	isMoveable = isMovable
	isItemMoveable = isItemMovable
	saveData = saveServer
	savePlayers = saveServer
	getPlayerSkill = getPlayerSkillLevel
	getPlayerSkullType = getCreatureSkullType
	getAccountNumberByName = getAccountIdByName
	getIPByName = getIpByName
	getPlayersByIP = getPlayersByIp
	getThingfromPos = getThingFromPos
	getPlayersByAccountNumber = getPlayersByAccountId
	getIPByPlayerName = getIpByName
	getPlayersByIPNumber = getPlayersByIp
	getAccountNumberByPlayerName = getAccountIdByName
	convertIntToIP = doConvertIntegerToIp

	//lua-made functions
	doPlayerGiveItem(cid, itemid, amount, subType)
	doPlayerTakeItem(cid, itemid, amount)
	doPlayerBuyItem(cid, itemid, count, cost, charges)
	doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
	doPlayerSellItem(cid, itemid, count, cost)
	isInRange(pos, fromPos, toPos)
	isPremium(cid)
	getMonthDayEnding(day)
	getMonthString(m)
	getArticle(str)
	isNumber(str)
	getDistanceBetween(firstPosition, secondPosition)
	doPlayerAddAddons(cid, addon)
	isSorcerer(cid)
	isDruid(cid)
	isPaladin(cid)
	isKnight(cid)
	isRookie(cid)
	getConfigInfo(info)
	getDirectionTo(pos1, pos2)
	getPlayerLookPos(cid)
	getPosByDir(fromPosition, direction, size)
	getPlayerMoney(cid)
	doPlayerWithdrawAllMoney(cid)
	doPlayerDepositAllMoney(cid)
	doPlayerTransferAllMoneyTo(cid, target)
	playerExists(name)
	getTibiaTime()
	doWriteLogFile(file, text)
	isInArea(pos, fromPos, toPos)
	getExperienceForLevel(lv)
	doMutePlayer(cid, time)
	getPlayerVocationName(cid)
	getPromotedVocation(vid)
	doPlayerRemovePremiumDays(cid, days)
	getPlayerMasterPos(cid)
	getOnlinePlayers()
	getPlayerByName(name)
	getPlayerFrags(cid)
	doConvertIntegerToIp(int, mask)
	getBooleanFromString(str)
	doCopyItem(item, attributes)
	exhaustion.check(cid, storage)
	exhaustion.get(cid, storage)
	exhaustion.set(cid, storage, time)
	exhaustion.make(cid, storage, time)
	table.find(table, value)
	table.isStrIn(txt, str)
	table.countElements(table, item)
	table.getCombinations(table, num)
	string.split(str)
	string.trim(str)
	string.explode(str, sep)
]

LUA_FUNCTIONS_1

Code:
[ LUA FUNCTIONS
	Project Name
		The Forgotten Server

	Version
		0.3 Beta 3

	Codenamed
		\

	License
		GNU GPLv3

	Forum
		http://otland.net/
]

[ ABOUT
	List with all Lua functions available.
	You can read a short instructions for all the functions;
		how to use, what it returns and an usage example.
]

[ "get" functions
	Introduction
		These functions will return a requested string or value.

	LIST
		getPlayerFood(cid)
			Info
				This function will check how many seconds a player is full.

			Returns
				Time in second for which player is full: 360.
					Ham - 360, Meat - 180, Fish - 145

		getCreatureHealth(cid)
			Info
				This function will check for creatures health points.

			Returns
				Creatures current health points.

		getCreatureMaxHealth(cid)
			Info
				This function will check for creatures max health points.

			Returns
				Creatures max health points.

		getCreatureMana(cid)
			Info
				This function will check for creatures mana points.

			Returns
				Creatures current mana points.

		getCreatureMaxMana(cid)
			Info
				This function will check for creatures max mana points.

			Returns
				Creatures max mana points.

		getPlayerLevel(cid)
			Info
				This function will check for players current level.

			Returns
				Players current level.

		getPlayerMagLevel(cid)
			Info
				This function will check for players current magic level.

			Returns
				Players current magic level.

		getCreatureName(cid)
			Info
				This function will check for creature name.

			Returns
				Creature name.

		getPlayerAccess(cid)
			Info
				This function will check for players access.

			Returns
				Players access.

		getCreaturePosition(cid)
			Info
				This function will check for current creature position.

			Returns
				Position in array
					Example
						{x = 127, y = 7, z = 9, stackpos = 1}
						{x = 396, y = 582, z = 13, stackpos = 2} (when creature is on an item)

			Example
				local cPos = getCreaturePosition(cid)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your current position is [X: "..cPos.x.." | Y: "..cPos.y.." | Z: "..cPos.z.."].")

		getPlayerSkillLevel(cid, skillid)
			Info
				This function will check for player actually position.
					Skillid can be:
						0 = Fist Fighting
						1 = Club Fighting
						2 = Sword Fighting
						3 = Axe Fighting
						4 = Distance Fighting
						5 = Shielding
						5 = Fishing

			Returns
				Player skill value.
					For Example
						37
						10

			Example
				if getPlayerSkillLevel(cid, 2) >= 20 then --Checking for sword skill value
					doPlayerAddItem(cid, 2376, 1) --give sword, when skill >= 20
				else
					doPlayerSendCancel(cid, "Sorry, your sword skill is not high enough.")
				end

		getPlayerTown(cid)
			Info
				This function will check player actually Town ID.

			Returns
				Player Town ID.
					For Example:
						1
						3

			Example
				local playerPos = getCreaturePosition(cid)
				if getPlayerTown(cid) == 1 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 1 (Main City)! :)', TEXTCOLOR_GOLD)
				elseif getPlayerTown(cid) == 2 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 2 (Desert City)! :)', TEXTCOLOR_GOLD)
				end

		getPlayerVocation(cid)
			Info
				This function will check player Vocation ID.

			Returns
				Player Vocation ID.
					For Example:
						1 - when player vocation is Sorcerer
						7 - when player vocation is Royal Paladin

			Example
				local playerVoc = getPlayerVocation(cid)
					if playerVoc == 1 or playerVoc == 5 then --If Vocation is Sorcerer or Master Sorcerer then weapon = Wand
						weapon == 2190 --Wand of vortex
					elseif playerVoc == 2 or playerVoc == 6 then --If Voc == Druid or Elder Druid then weapon = Rod
						weapon == 2182 --Snakebite Rod
					elseif playerVoc == 3 or playerVoc == 7 then --If Voc == Paladin or Royal Paladin then weapon = Spear
						weapon == 2389 --Spear
					elseif playerVoc == 4 or playerVoc == 8 then --If Voc == Knight or Elite Knight then weapon = Sword
						weapon == 2412 --Katana
					end
				doPlayerAddItem(cid, weapon, 1)

		getPlayerItemCount(cid,itemid)
			Info
				This function will check how much items with == itemid player actually have.

			Returns
				Count of itemid.
					For Example:
						2 - when player have 2x royal spear
						189 - when player have 189 platinum coins

			Example
				local crystalCoins = getPlayerItemCount(cid, 2160)
				local platinumCoins = getPlayerItemCount(cid, 2152)
				local goldCoins = getPlayerItemCount(cid, 2148)
					money = crystalCoins * 10000 + platinumCoins * 100 + goldCoins
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your money: " ..money.. "gp")

		getPlayerSoul(cid)
			Info
				This function will check how much soul points player actually have.

			Returns
				Player actually soul points.
					For Example:
						27 - when player have 27 soul points
						134 - when player have 134 soul points

			Example
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your soul points: " ..getPlayerSoul(cid))

		getPlayerFreeCap(cid)
			Info
				This function will check how much free cap points player actually have.

			Returns
				Player actually cap points.
					For Example:
						181 - when player have 181 capacity
						1460 - when player have 1460 capacity

			Example
				local playerCap = getPlayerFreeCap(cid)
				local item = 2393 --Giant Sword
				local itemweight = getItemWeight(item, 1)
					if playerCap >= itemweight then
						doPlayerSendTextMessage(cid,22,'You have found a giant sword.')
						doPlayerAddItem(cid,item,1)
					else
						doPlayerSendTextMessage(cid, 22, 'You have found a giant sword weighing ' ..itemweight.. ' oz it\'s too heavy.')

		getPlayerLight(cid)
			Info
				This function will check for player actually light.

			Returns
				Player actually light.
					For Example:
						215 - after using "utevo gran lux"

		getPlayerSlotItem(cid, slot)
			Info
				This function will check what item player have actually in slot.
					Skillid can be:
						1 = helmet
						2 = necklace slot (amulet of loss etc.)
						3 = backpack, bag
						4 = armor
						5 = left hand (its really hand placed >> (right page on screen))
						6 = right hand (its really hand placed << (left page on screen))
						7 = legs
						8 = boots
						9 = ring slot
						10 = ammo slot (arrows etc.)

			Returns
				Array with item which is actually in slot. When slot is empty, then return = 0 (FALSE)
					For Example:
						{itemid = 2493, uid = 70001, actionid = 0} (demon helmet, slot = 1)

			Example
				if getPlayerSlotItem(cid, 2) == 2173 then  --checking for amulet of loss
					doPlayerSendTextMessage(cid,22,'Ok, you can go.')
				else
					doPlayerSendTextMessage(cid,22,'Sorry, you need amulet of loss to go.')
					doTeleportThing(cid, fromPosition, TRUE)
				end

		getPlayerDepotItems(cid, depotid)
			Info
				This function will check how much items (slots reserved, becouse 10cc = 1 slot) player have in depo.
					Depotid = number, which depo we want to check.

			Returns
				Busy slots in depot.
					For example:
						7 - when player have in depo:
							- sword
							- rope
							- 100 uh
							- parcel (inside: 10 crystal coins + label)
							- depot chest (standard, all players have it)

			Example
				depotItems = getPlayerDepotItems(cid, 3)  -- 3 = Desert City
				if depotItems < 2 then --When depo contains only 1 ITEM.
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains 1 item.")
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains " ..depotItems.. " items.")
				end


		getPlayerSex(cid)
			Info
				This function will check player sex.

			Returns
				Player sex.
					For example:
						0 - when player is female
						1 - when player is male

			Example
				if getPlayerSex(cid) then --when female
					doSendAnimatedText(playerPos, 'GiRl :*:*', TEXTCOLOR_GOLD)
				elseif getPlayerSex(cid) then --male
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				else -- dont know how it is in english, but in polish = obojniak - something between boy and girl :P
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				end

		getPlayerLookDir(cid)
			Info
				This function will check player direction.

			Returns
				Player direction.
					For example:
						0 - player is looking up (north) (/\)
						1 - player is looking right (east) (>)
						2 - player is looking down (south) (\/)
						3 - player is looking left (west) (<)

			Example
				local direction = getPlayerLookDir(cid)
				if direction = 0 then --when north
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to north")
				elseif direction = 1 then --when east
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to east")
				elseif direction = 2 then --when south
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to south")
				else --when west
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to west")
				end

		getPlayerGUID(cid)
			Info
				This function will check for player id.

			Returns
				Player id. When checked creature isn't player then return = -1
					For example:
						61 - when player id in database is 61
						-1 - when checked creature is NPC

			Example
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are player with id: "..getPlayerGUID(cid))

		getPlayerFlagValue(cid, flag)
			Info
				This function will check player flag value.
			Returns
				Return flag value. 1 = when true (player have this flag), 0 = when false (havent)
					For example:
						1 - checking GM for flag 8 (Can not be attacked)
						0 - checking player for flag 8 (Can not be attacked)

			Example
				flagValue = getPlayerFlagValue(cid, 32) --32 "Can summon all monsters"
					if flagValue = 1 then --if can
						doSummonCreature("Demon", fromPosition.x + 1)
					else --if cant
						doSummonCreature("Rat", fromPosition.x + 1)
					end

		getPlayerGroupId(cid)
			Info
				This function will check player group ID.

			Returns
				Player group id.
					For example (using standard TFS groups):
						1 - when checked player is player
						2 - when checked player is gamemaster
						3 - when checked player is god

			Example
				local group = getPlayerGroupId(cid)
					if group == 3 --when God
						doPlayerAddItem(cid,2160,100) --100 crystal coins
					elseif group == 2 --when Gamemaster
						doPlayerAddItem(cid,2160,50) --50 crystal coins
					else
						doPlayerSendCancel(cid, "Sorry, cheats doesnt work for you."
					end

		getPlayerGuildId(cid)
			Info
				This function will return the players guild id.

			Returns
				Players guild id.
					For example
						21 - The guild the player is in has the guild id 21, as stored in the database.

			Example
				local guildId = getPlayerGuildId(cid)
					if guildId == 21 then
						doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Welcome in!")
					elseif guildId == 22 then
						doPlayerSendCancel(cid,"This area is not for your guild")
					end

		getPlayerGuildName(cid)
			Info
				Used to get a players guild name.

			Returns
				Players guild name in a string.
					For example
						"Lost Dragons"

			Example
				local guildName = getPlayerGuildName(cid)
				doSendAnimatedText(getCreaturePosition(cid),guildName, TEXTCOLOR_GOLD)

		getPlayerGuildRank(cid)
			Info
				Used to get a players rank name in a guild.

			Returns
				The players current rank in his guild in a string
					For example
						"Senator"

			Example
				local rank = getPlayerGuildRank(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You're a " .. rank .. " in your guild.")

		getPlayerGuildNick(cid)
			Info
				Used to get a players nick in his guild.

			Returns
				The players current nick in a string.
					For example
						"The protector"

			Example
				local guildNick = getPlayerGuildNick(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your guild nick is " .. guildNick .. ".")
]

[ "do" functions
	Introduction
		These functions usually execute an action.

	List
		doPlayerSendCancel(cid, text)
			Info
				This function will send default cancel message do player (visible in bottom of

			Returns
				Return 1 (TRUE) - when msg was sent, 0 - when it was impossible (FALSE)

			Example
				if getPlayerLevel(cid) >= 10 then --checking level
					doSummonCreature("Chicken", fromPosition.x + 1)
				else
					doPlayerSendCancel(cid, "Sorry, your level isnt enought to summon this monster."
				end
]

[ LIST
	//get*
	getCreatureHealth(cid)
	getCreatureMaxHealth(cid)
	getCreatureMana(cid)
	getCreatureMaxMana(cid)
	getCreatureMaster(cid)
	getCreatureSummons(cid)
	getCreatureOutfit(cid)
	getCreaturePosition(cid)
	getCreatureName(cid)
	getCreatureSpeed(cid)
	getCreatureBaseSpeed(cid)
	getCreatureTarget(cid)
	getCreatureByName(name)
	getCreatureSkullType(cid)
	getCreatureCondition(cid, condition)
	getMonsterTargetList(cid)
	getMonsterFriendList(cid)
	getPlayerByNameWildcard(name~)
	getPlayerLossSkill(cid)
	getPlayerLossPercent(cid, lossType)
	getPlayerGUIDByName(name)
	getPlayerNameByGUID(guid)
	getPlayerFood(cid)
	getPlayerLevel(cid)
	getPlayerExperience(cid)
	getPlayerMagLevel(cid)
	getPlayerSpentMana(cid)
	getPlayerAccess(cid)
	getPlayerSkillLevel(cid, skillid)
	getPlayerSkillTries(cid, skillid)
	getPlayerTown(cid)
	getPlayerVocation(cid)
	getPlayerRequiredMana(cid, magicLevel)
	getPlayerRequiredSkillTries(cid, skillId, skillLevel)
	getPlayerItemCount(cid, itemid)
	getPlayerSoul(cid)
	getPlayerAccountId(cid)
	getPlayerAccount(cid)
	getPlayerIp(cid)
	getPlayerFreeCap(cid)
	getPlayerLight(cid)
	getPlayerSlotItem(cid, slot)
	getPlayerWeapon(cid[, ignoreAmmo])
	getPlayerItemById(cid, deepSearch, itemId[, subType])
	getPlayerDepotItems(cid, depotid)
	getPlayerGuildId(cid)
	getPlayerGuildName(cid)
	getPlayerGuildRank(cid)
	getPlayerGuildNick(cid)
	getPlayerGuildLevel(cid)
	getPlayerSex(cid)
	getPlayerLookDir(cid)
	getPlayerStorageValue(uid, valueid)
	getPlayerGUID(cid)
	getPlayerFlagValue(cid, flag)
	getPlayerCustomFlagValue(cid, flag)
	getPlayerPromotionLevel(cid)
	getPlayerGroupId(cid)
	getPlayerLearnedInstantSpell(cid, name)
	getPlayerInstantSpellCount(cid)
	getPlayerInstantSpellInfo(cid, index)
	getPlayerSex(cid)
	getPlayerBlessing(cid, blessing)
	getPlayerStamina(cid)
	getPlayerNoMove(cid)
	getPlayerExtraExpRate(cid)
	getPlayerPartner(cid)
	getPlayerParty(cid)
	getPlayerPremiumDays(cid)
	getPlayerBalance(cid)
	getPlayerRedSkullTicks(cid)
	getInstantSpellInfoByName(cid, name)
	getInstantSpellWords(name)
	getPlayersByAccountId(accountNumber)
	getPlayersByIp(ip[, mask = 0xFFFFFFFF])
	getPlayersOnline()
	getPartyMembers(lid)
	getAccountIdByName(name)
	getAccountByName(name)
	getAccountIdByAccount(accName)
	getIpByName(name)
	getItemRWInfo(uid)
	getItemDescriptionsById(itemid)
	getItemNameById(itemid)
	getItemPluralNameById(itemid)
	getItemArticleById(itemid)
	getItemWeightById(itemid, count[, precise])
	getItemDescriptions(uid)
	getItemName(uid)
	getItemPluralName(uid)
	getItemArticle(uid)
	getItemWeight(uid[, precise])
	getItemAttack(uid)
	getItemExtraAttack(uid)
	getItemDefense(uid)
	getItemExtraDefense(uid)
	getItemArmor(uid)
	getItemAttackSpeed(uid)
	getItemHitChance(uid)
	getItemIdByName(name)
	getFluidSourceType(type)
	getContainerSize(uid)
	getContainerCap(uid)
	getContainerCapById(itemid)
	getContainerItem(uid, slot)
	getDepotId(uid)
	getTileItemById(pos, itemId[, subType])
	getTileItemByType(pos, type)
	getTileThingByPos(pos)
	getTilePzInfo(pos)
	getTileHouseInfo(pos)
	getTopCreature(pos)
	getClosestFreeTile(cid, targetpos[, extended[, ignoreHouse]])
	getThingFromPos(pos)
	getThing(uid)
	getThingPos(uid)
	getHouseOwner(houseid)
	getHouseName(houseid)
	getHouseEntry(houseid)
	getHouseRent(houseid)
	getHousePrice(houseid)
	getHouseTown(houseid)
	getHouseAccessList(houseid, listid)
	getHouseByPlayerGUID(playerGUID)
	getHouseTilesSize(houseid)
	getTownId(townName)
	getTownName(townId)
	getTownTemplePosition(townId)
	getTownHouses(townId)
	getWorldType()
	getWorldTime()
	getWorldLight()
	getWorldCreatures(type) //0 players, 1 monsters, 2 npcs, 3 all
	getWorldUpTime()
	getHighscoreString(skillId)
	getVocationInfo(id)
	getGuildId(guildName)
	getSpectators(centerPos, rangex, rangey, multifloor)
	getSearchString(fromPosition, toPosition[, isPlayer])
	getNotationsCound(accId)
	getBanData(value)
	getBanList(type[, value])
	getBanReason(id)
	getBanAction(id[, ipBanishment])
	getGlobalStorageValue(valueid)
	getConfigFile()
	getLogsDir()
	getDataDir()

	//set*
	setCreatureMaxHealth(cid, health)
	setCreatureMaxMana(cid, mana)
	setPlayerStorageValue(uid, valueid, newvalue)
	setPlayerGroupId(cid, newGroupId)
	setPlayerPromotionLevel(cid, level)
	setPlayerStamina(cid, minutes)
	setPlayerExtraExpRate(cid, value)
	setPlayerPartner(cid, guid)
	setHouseOwner(houseid, ownerGUID)
	setHouseAccessList(houseid, listid, listtext)
	setItemName(uid)
	setItemPluralName(uid)
	setItemIdArticle(uid)
	setItemAttack(uid, attack)
	setItemExtraAttack(uid, extraattack)
	setItemDefense(uid, defense)
	setItemArmor(uid, armor)
	setItemExtraDefense(uid, extradefense)
	setItemAttackSpeed(uid, attackspeed)
	setItemHitChance(uid, hitChance)
	setCombatArea(combat, area)
	setCombatCondition(combat, condition)
	setCombatParam(combat, key, value)
	setConditionParam(condition, key, value)
	setCombatCallBack(combat, key, function_name)
	setCombatFormula(combat, type, mina, minb, maxa, maxb)
	setConditionFormula(combat, mina, minb, maxa, maxb)
	setGlobalStorageValue(valueid, newvalue)
	setWorldType(type)

	//do*
	doCreatureAddHealth(cid, health[, force])
	doCreatureAddMana(cid, mana)
	doCreatureSetDropLoot(cid, doDrop)
	doCreatureSetSkullType(cid, skull)
	doCreatureChangeOutfit(cid, outfit)
	doCreatureSay(cid, text, type[, pos])
	doSetCreatureLight(cid, lightLevel, lightColor, time)
	doSetCreatureOutfit(cid, outfit, time)
	doRemoveCreature(cid)
	doMoveCreature(cid, direction)
	doSummonCreature(name, pos)
	doConvinceCreature(cid, target)
	doChallengeCreature(cid, target)
	doChangeSpeed(cid, delta)
	doMonsterChangeTarget(cid)
	doMonsterSetTarget(cid, target)
	doSetMonsterOutfit(cid, name, time)
	doPlayerBroadcastMessage(cid, message[, type])
	doPlayerSetSex(cid, newSex)
	doPlayerSetTown(cid, townid)
	doPlayerSetVocation(cid,voc)
	doPlayerRemoveItem(cid, itemid, count[, subtype])
	doPlayerAddExp(cid, exp)
	doPlayerSetGuildId(cid, id)
	doPlayerSetGuildRank(cid, rank)
	doPlayerSetGuildNick(cid, nick)
	doPlayerAddOutfit(cid,looktype, addons)
	doPlayerRemoveOutfit(cid,looktype, addons)
	doPlayerSetRedSkullTicks(cid, amount)
	doPlayerSetLossPercent(cid, lossType, newPercent)
	doPlayerSetLossSkill(cid, doLose)
	doPlayerAddSkillTry(cid, skillid, n)
	doPlayerAddSpentMana(cid, amount)
	doPlayerAddSoul(cid, soul)
	doPlayerAddItem(uid, itemid[, count/subtype[, canDropOnMap]])
	doPlayerAddItemEx(cid, uid[, canDropOnMap])
	doPlayerSendTextMessage(cid, MessageClasses, message)
	doPlayerAddMoney(cid, money)
	doPlayerRemoveMoney(cid, money)
	doPlayerWithdrawMoney(cid, money)
	doPlayerDepositMoney(cid, money)
	doPlayerTransferMoneyTo(cid, target, money)
	doPlayerPopupFYI(cid, message)
	doPlayerSendTutorial(cid, id)
	doPlayerAddMapMark(cid, pos, type[, description])
	doPlayerAddPremiumDays(cid, days)
	doPlayerAddBlessing(cid, blessing)
	doPlayerAddStamina(cid, minutes)
	doPlayerSetNoMove(cid, cannotMove)
	doPlayerResetIdleTime(cid)
	doPlayerLearnInstantSpell(cid, name)
	doPlayerFeed(cid, food)
	doPlayerSendCancel(cid, text)
	doPlayerSendDefaultCancel(cid, ReturnValue)
	doCreateItem(itemid, type/count, pos)
	doCreateItemEx(itemid[, count/subtype])
	doAddContainerItemEx(uid, virtuid)
	doAddContainerItem(uid, itemid[, count/subtype])
	doChangeTypeItem(uid, newtype)
	doDecayItem(uid)
	doRemoveItem(uid[, n])
	doTransformItem(uid, toitemid[, count/subtype])
	doSetItemActionId(uid, actionid)
	doSetItemText(uid, text)
	doSetItemSpecialDescription(uid, desc)
	doSetItemOutfit(cid, item, time)
	doTileAddItemEx(pos, uid)
	doAddCondition(cid, condition)
	doRemoveCondition(cid, type)
	doAreaCombatHealth(cid, type, pos, area, min, max, effect)
	doTargetCombatHealth(cid, target, type, min, max, effect)
	doAreaCombatMana(cid, pos, area, min, max, effect)
	doTargetCombatMana(cid, target, min, max, effect)
	doAreaCombatCondition(cid, pos, area, condition, effect)
	doTargetCombatCondition(cid, target, condition, effect)
	doAreaCombatDispel(cid, pos, area, type, effect)
	doTargetCombatDispel(cid, target, type, effect)
	doCombat(cid, combat, param)
	doTeleportThing(cid, newpos[, pushmove])
	doCreateTeleport(itemid, topos, createpos)
	doSendMagicEffect(pos, type[, creature])
	doSendDistanceShoot(frompos, topos, type[, creature])
	doSendAnimatedText(pos, text, color[, creature])
	doShowTextDialog(cid, itemid, text)
	doRelocate(pos, posTo)
	doBroadcastMessage(message, type)
	doAddIpBanishment(ip[, length[, comment[, admin]]])
	doAddNamelock(name[, reason[, action[, comment[, admin]]]])
	doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])
	doAddDeletion(accId[, reason[, action[, comment[, admin]]]]])
	doAddNotation(accId[, reason[, action[, comment[, admin]]]]])
	doRemoveIpBanishment(ip[, mask])
	doRemoveNamelock(name)
	doRemoveBanisment(accId)
	doRemoveDeletion(accId)
	doRemoveNotations(accId)


	//is*
	isCreature(cid)
	isMonster(uid)
	isNpc(uid)
	isPlayer(cid)
	isPlayerPzLocked(cid)
	isPlayerGhost(cid)
	isItemStackable(itemid)
	isItemRune(itemid)
	isItemDoor(itemid)
	isItemLevelDoor(itemid)
	isItemContainer(itemid)
	isItemFluidContainer(itemid)
	isItemMovable(itemid)
	isContainer(uid)
	isCorpse(uid)
	isMovable(uid)
	isSightClear(fromPos, toPos, floorCheck)
	isIpBanished(ip[, mask])
	isPlayerNamelocked(name)
	isAccountBanished(accId)
	isAccountDeleted(accId)
	isInArray({array}, value)

	//others
	registerCreatureEvent(uid, eventName)
	createCombatArea({area}[, {exArea}])
	createConditionObject(type)
	addDamageCondition(condition, rounds, time, value)
	addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
	createCombatObject()
	numberToVariant(number)
	stringToVariant(string)
	positionToVariant(pos)
	targetPositionToVariant(pos)
	variantToNumber(var)
	variantToString(var)
	variantToPosition(var)
	canPlayerLearnInstantSpell(cid, name)
	queryTileAddThing(uid, pos[, flags])
	canPlayerWearOutfit(cid, looktype, addons)
	executeRaid(name)
	saveServer()
	cleanHouse(houseId)
	cleanMap()
	shutdown()
	addEvent(callback, delay, ...)
	stopEvent(eventid)
	debugPrint(text)
	hasProperty(uid)

	//db table
	db.executeQuery(query)
	db.storeQuery(query)
	db.escapeString(str)
	db.escapeBlob(s, length)
	db.stringComparisonOperator()

	//result table
	result.getDataInt(resId, s)
	result.getDataLong(resId, s)
	result.getDataString(resId, s)
	result.getDataStream(resId, s, length)
	result.next(resId)
	result.free(resId)

	//bit table
	#bit.cast
	bit.bnot(n)
	bit.band(type, n)
	bit.bor(type, n)
	bit.bxor(type, n)
	bit.lshift(type, n)
	bit.rshift(type, n)
	#bit.arshift
	#bit.ucast
	bit.ubnot(n)
	bit.uband(type, n)
	bit.ubor(type, n)
	bit.ubxor(type, n)
	bit.ulshift(type, n)
	bit.urshift(type, n)
	#bit.uarshift

	//compats
	table.getPos = table.find
	doSetCreatureDropLoot = doCreatureSetDropLoot
	doPlayerSay = doCreatureSay
	doPlayerAddMana = doCreatureAddMana
	playerLearnInstantSpell = doPlayerLearnInstantSpell
	doPlayerRemOutfit = doPlayerRemoveOutfit
	pay = doPlayerRemoveMoney
	broadcastMessage = doBroadcastMessage
	getPlayerName = getCreatureName
	getPlayerPosition = getCreaturePosition
	getCreaturePos = getCreaturePosition
	creatureGetPosition = getCreaturePosition
	getPlayerMana = getCreatureMana
	getPlayerMaxMana = getCreatureMaxMana
	hasCondition = getCreatureCondition
	isMoveable = isMovable
	isItemMoveable = isItemMovable
	saveData = saveServer
	savePlayers = saveServer
	getPlayerSkill = getPlayerSkillLevel
	getPlayerSkullType = getCreatureSkullType
	getAccountNumberByName = getAccountIdByName
	getIPByName = getIpByName
	getPlayersByIP = getPlayersByIp
	getThingfromPos = getThingFromPos
	getPlayersByAccountNumber = getPlayersByAccountId
	getIPByPlayerName = getIpByName
	getPlayersByIPNumber = getPlayersByIp
	getAccountNumberByPlayerName = getAccountIdByName
	convertIntToIP = doConvertIntegerToIp

	//lua-made functions
	doPlayerGiveItem(cid, itemid, amount, subType)
	doPlayerTakeItem(cid, itemid, amount)
	doPlayerBuyItem(cid, itemid, count, cost, charges)
	doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
	doPlayerSellItem(cid, itemid, count, cost)
	isInRange(pos, fromPos, toPos)
	isPremium(cid)
	getMonthDayEnding(day)
	getMonthString(m)
	getArticle(str)
	isNumber(str)
	getDistanceBetween(firstPosition, secondPosition)
	doPlayerAddAddons(cid, addon)
	isSorcerer(cid)
	isDruid(cid)
	isPaladin(cid)
	isKnight(cid)
	isRookie(cid)
	getConfigInfo(info)
	getDirectionTo(pos1, pos2)
	getPlayerLookPos(cid)
	getPosByDir(fromPosition, direction, size)
	getPlayerMoney(cid)
	doPlayerWithdrawAllMoney(cid)
	doPlayerDepositAllMoney(cid)
	doPlayerTransferAllMoneyTo(cid, target)
	playerExists(name)
	getTibiaTime()
	doWriteLogFile(file, text)
	isInArea(pos, fromPos, toPos)
	getExperienceForLevel(lv)
	doMutePlayer(cid, time)
	getPlayerVocationName(cid)
	getPromotedVocation(vid)
	doPlayerRemovePremiumDays(cid, days)
	getPlayerMasterPos(cid)
	getOnlinePlayers()
	getPlayerByName(name)
	getPlayerFrags(cid)
	doConvertIntegerToIp(int, mask)
	getBooleanFromString(str)
	doCopyItem(item, attributes)
	exhaustion.check(cid, storage)
	exhaustion.get(cid, storage)
	exhaustion.set(cid, storage, time)
	exhaustion.make(cid, storage, time)
	table.find(table, value)
	table.isStrIn(txt, str)
	table.countElements(table, item)
	table.getCombinations(table, num)
	string.split(str)
	string.trim(str)
	string.explode(str, sep)
]
 
LUA_FUNCTIONS_2

Code:
[ LUA FUNCTIONS
	Project Name
		The Forgotten Server

	Version
		0.3 Beta 3

	Codenamed
		\

	License
		GNU GPLv3

	Forum
		http://otland.net/
]

[ ABOUT
	List with all Lua functions available.
	You can read a short instructions for all the functions;
		how to use, what it returns and an usage example.
]

[ "get" functions
	Introduction
		These functions will return a requested string or value.

	LIST
		getPlayerFood(cid)
			Info
				This function will check how many seconds a player is full.

			Returns
				Time in second for which player is full: 360.
					Ham - 360, Meat - 180, Fish - 145

		getCreatureHealth(cid)
			Info
				This function will check for creatures health points.

			Returns
				Creatures current health points.

		getCreatureMaxHealth(cid)
			Info
				This function will check for creatures max health points.

			Returns
				Creatures max health points.

		getCreatureMana(cid)
			Info
				This function will check for creatures mana points.

			Returns
				Creatures current mana points.

		getCreatureMaxMana(cid)
			Info
				This function will check for creatures max mana points.

			Returns
				Creatures max mana points.

		getPlayerLevel(cid)
			Info
				This function will check for players current level.

			Returns
				Players current level.

		getPlayerMagLevel(cid)
			Info
				This function will check for players current magic level.

			Returns
				Players current magic level.

		getCreatureName(cid)
			Info
				This function will check for creature name.

			Returns
				Creature name.

		getPlayerAccess(cid)
			Info
				This function will check for players access.

			Returns
				Players access.

		getCreaturePosition(cid)
			Info
				This function will check for current creature position.

			Returns
				Position in array
					Example
						{x = 127, y = 7, z = 9, stackpos = 1}
						{x = 396, y = 582, z = 13, stackpos = 2} (when creature is on an item)

			Example
				local cPos = getCreaturePosition(cid)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your current position is [X: "..cPos.x.." | Y: "..cPos.y.." | Z: "..cPos.z.."].")

		getPlayerSkillLevel(cid, skillid)
			Info
				This function will check for player actually position.
					Skillid can be:
						0 = Fist Fighting
						1 = Club Fighting
						2 = Sword Fighting
						3 = Axe Fighting
						4 = Distance Fighting
						5 = Shielding
						5 = Fishing

			Returns
				Player skill value.
					For Example
						37
						10

			Example
				if getPlayerSkillLevel(cid, 2) >= 20 then --Checking for sword skill value
					doPlayerAddItem(cid, 2376, 1) --give sword, when skill >= 20
				else
					doPlayerSendCancel(cid, "Sorry, your sword skill is not high enough.")
				end

		getPlayerTown(cid)
			Info
				This function will check player actually Town ID.

			Returns
				Player Town ID.
					For Example:
						1
						3

			Example
				local playerPos = getCreaturePosition(cid)
				if getPlayerTown(cid) == 1 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 1 (Main City)! :)', TEXTCOLOR_GOLD)
				elseif getPlayerTown(cid) == 2 then
					doSendAnimatedText(playerPos, 'I am leaving in town with id: 2 (Desert City)! :)', TEXTCOLOR_GOLD)
				end

		getPlayerVocation(cid)
			Info
				This function will check player Vocation ID.

			Returns
				Player Vocation ID.
					For Example:
						1 - when player vocation is Sorcerer
						7 - when player vocation is Royal Paladin

			Example
				local playerVoc = getPlayerVocation(cid)
					if playerVoc == 1 or playerVoc == 5 then --If Vocation is Sorcerer or Master Sorcerer then weapon = Wand
						weapon == 2190 --Wand of vortex
					elseif playerVoc == 2 or playerVoc == 6 then --If Voc == Druid or Elder Druid then weapon = Rod
						weapon == 2182 --Snakebite Rod
					elseif playerVoc == 3 or playerVoc == 7 then --If Voc == Paladin or Royal Paladin then weapon = Spear
						weapon == 2389 --Spear
					elseif playerVoc == 4 or playerVoc == 8 then --If Voc == Knight or Elite Knight then weapon = Sword
						weapon == 2412 --Katana
					end
				doPlayerAddItem(cid, weapon, 1)

		getPlayerItemCount(cid,itemid)
			Info
				This function will check how much items with == itemid player actually have.

			Returns
				Count of itemid.
					For Example:
						2 - when player have 2x royal spear
						189 - when player have 189 platinum coins

			Example
				local crystalCoins = getPlayerItemCount(cid, 2160)
				local platinumCoins = getPlayerItemCount(cid, 2152)
				local goldCoins = getPlayerItemCount(cid, 2148)
					money = crystalCoins * 10000 + platinumCoins * 100 + goldCoins
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your money: " ..money.. "gp")

		getPlayerSoul(cid)
			Info
				This function will check how much soul points player actually have.

			Returns
				Player actually soul points.
					For Example:
						27 - when player have 27 soul points
						134 - when player have 134 soul points

			Example
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your soul points: " ..getPlayerSoul(cid))

		getPlayerFreeCap(cid)
			Info
				This function will check how much free cap points player actually have.

			Returns
				Player actually cap points.
					For Example:
						181 - when player have 181 capacity
						1460 - when player have 1460 capacity

			Example
				local playerCap = getPlayerFreeCap(cid)
				local item = 2393 --Giant Sword
				local itemweight = getItemWeight(item, 1)
					if playerCap >= itemweight then
						doPlayerSendTextMessage(cid,22,'You have found a giant sword.')
						doPlayerAddItem(cid,item,1)
					else
						doPlayerSendTextMessage(cid, 22, 'You have found a giant sword weighing ' ..itemweight.. ' oz it\'s too heavy.')

		getPlayerLight(cid)
			Info
				This function will check for player actually light.

			Returns
				Player actually light.
					For Example:
						215 - after using "utevo gran lux"

		getPlayerSlotItem(cid, slot)
			Info
				This function will check what item player have actually in slot.
					Skillid can be:
						1 = helmet
						2 = necklace slot (amulet of loss etc.)
						3 = backpack, bag
						4 = armor
						5 = left hand (its really hand placed >> (right page on screen))
						6 = right hand (its really hand placed << (left page on screen))
						7 = legs
						8 = boots
						9 = ring slot
						10 = ammo slot (arrows etc.)

			Returns
				Array with item which is actually in slot. When slot is empty, then return = 0 (FALSE)
					For Example:
						{itemid = 2493, uid = 70001, actionid = 0} (demon helmet, slot = 1)

			Example
				if getPlayerSlotItem(cid, 2) == 2173 then  --checking for amulet of loss
					doPlayerSendTextMessage(cid,22,'Ok, you can go.')
				else
					doPlayerSendTextMessage(cid,22,'Sorry, you need amulet of loss to go.')
					doTeleportThing(cid, fromPosition, TRUE)
				end

		getPlayerDepotItems(cid, depotid)
			Info
				This function will check how much items (slots reserved, becouse 10cc = 1 slot) player have in depo.
					Depotid = number, which depo we want to check.

			Returns
				Busy slots in depot.
					For example:
						7 - when player have in depo:
							- sword
							- rope
							- 100 uh
							- parcel (inside: 10 crystal coins + label)
							- depot chest (standard, all players have it)

			Example
				depotItems = getPlayerDepotItems(cid, 3)  -- 3 = Desert City
				if depotItems < 2 then --When depo contains only 1 ITEM.
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains 1 item.")
				else
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your depot contains " ..depotItems.. " items.")
				end


		getPlayerSex(cid)
			Info
				This function will check player sex.

			Returns
				Player sex.
					For example:
						0 - when player is female
						1 - when player is male

			Example
				if getPlayerSex(cid) then --when female
					doSendAnimatedText(playerPos, 'GiRl :*:*', TEXTCOLOR_GOLD)
				elseif getPlayerSex(cid) then --male
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				else -- dont know how it is in english, but in polish = obojniak - something between boy and girl :P
					doSendAnimatedText(playerPos, 'Wtf? I aM BoY.', TEXTCOLOR_GOLD)
				end

		getPlayerLookDir(cid)
			Info
				This function will check player direction.

			Returns
				Player direction.
					For example:
						0 - player is looking up (north) (/\)
						1 - player is looking right (east) (>)
						2 - player is looking down (south) (\/)
						3 - player is looking left (west) (<)

			Example
				local direction = getPlayerLookDir(cid)
				if direction = 0 then --when north
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to north")
				elseif direction = 1 then --when east
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to east")
				elseif direction = 2 then --when south
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to south")
				else --when west
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are looking to west")
				end

		getPlayerGUID(cid)
			Info
				This function will check for player id.

			Returns
				Player id. When checked creature isn't player then return = -1
					For example:
						61 - when player id in database is 61
						-1 - when checked creature is NPC

			Example
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You are player with id: "..getPlayerGUID(cid))

		getPlayerFlagValue(cid, flag)
			Info
				This function will check player flag value.
			Returns
				Return flag value. 1 = when true (player have this flag), 0 = when false (havent)
					For example:
						1 - checking GM for flag 8 (Can not be attacked)
						0 - checking player for flag 8 (Can not be attacked)

			Example
				flagValue = getPlayerFlagValue(cid, 32) --32 "Can summon all monsters"
					if flagValue = 1 then --if can
						doSummonCreature("Demon", fromPosition.x + 1)
					else --if cant
						doSummonCreature("Rat", fromPosition.x + 1)
					end

		getPlayerGroupId(cid)
			Info
				This function will check player group ID.

			Returns
				Player group id.
					For example (using standard TFS groups):
						1 - when checked player is player
						2 - when checked player is gamemaster
						3 - when checked player is god

			Example
				local group = getPlayerGroupId(cid)
					if group == 3 --when God
						doPlayerAddItem(cid,2160,100) --100 crystal coins
					elseif group == 2 --when Gamemaster
						doPlayerAddItem(cid,2160,50) --50 crystal coins
					else
						doPlayerSendCancel(cid, "Sorry, cheats doesnt work for you."
					end

		getPlayerGuildId(cid)
			Info
				This function will return the players guild id.

			Returns
				Players guild id.
					For example
						21 - The guild the player is in has the guild id 21, as stored in the database.

			Example
				local guildId = getPlayerGuildId(cid)
					if guildId == 21 then
						doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Welcome in!")
					elseif guildId == 22 then
						doPlayerSendCancel(cid,"This area is not for your guild")
					end

		getPlayerGuildName(cid)
			Info
				Used to get a players guild name.

			Returns
				Players guild name in a string.
					For example
						"Lost Dragons"

			Example
				local guildName = getPlayerGuildName(cid)
				doSendAnimatedText(getCreaturePosition(cid),guildName, TEXTCOLOR_GOLD)

		getPlayerGuildRank(cid)
			Info
				Used to get a players rank name in a guild.

			Returns
				The players current rank in his guild in a string
					For example
						"Senator"

			Example
				local rank = getPlayerGuildRank(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You're a " .. rank .. " in your guild.")

		getPlayerGuildNick(cid)
			Info
				Used to get a players nick in his guild.

			Returns
				The players current nick in a string.
					For example
						"The protector"

			Example
				local guildNick = getPlayerGuildNick(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Your guild nick is " .. guildNick .. ".")
]

[ "do" functions
	Introduction
		These functions usually execute an action.

	List
		doPlayerSendCancel(cid, text)
			Info
				This function will send default cancel message do player (visible in bottom of

			Returns
				Return 1 (TRUE) - when msg was sent, 0 - when it was impossible (FALSE)

			Example
				if getPlayerLevel(cid) >= 10 then --checking level
					doSummonCreature("Chicken", fromPosition.x + 1)
				else
					doPlayerSendCancel(cid, "Sorry, your level isnt enought to summon this monster."
				end
]

[ LIST
	//get*
	getCreatureHealth(cid)
	getCreatureMaxHealth(cid)
	getCreatureMana(cid)
	getCreatureMaxMana(cid)
	getCreatureMaster(cid)
	getCreatureSummons(cid)
	getCreatureOutfit(cid)
	getCreaturePosition(cid)
	getCreatureName(cid)
	getCreatureSpeed(cid)
	getCreatureBaseSpeed(cid)
	getCreatureTarget(cid)
	getCreatureByName(name)
	getCreatureSkullType(cid)
	getCreatureCondition(cid, condition)
	getMonsterTargetList(cid)
	getMonsterFriendList(cid)
	getPlayerByNameWildcard(name~)
	getPlayerLossSkill(cid)
	getPlayerLossPercent(cid, lossType)
	getPlayerGUIDByName(name)
	getPlayerNameByGUID(guid)
	getPlayerFood(cid)
	getPlayerLevel(cid)
	getPlayerExperience(cid)
	getPlayerMagLevel(cid)
	getPlayerSpentMana(cid)
	getPlayerAccess(cid)
	getPlayerSkillLevel(cid, skillid)
	getPlayerSkillTries(cid, skillid)
	getPlayerTown(cid)
	getPlayerVocation(cid)
	getPlayerRequiredMana(cid, magicLevel)
	getPlayerRequiredSkillTries(cid, skillId, skillLevel)
	getPlayerItemCount(cid, itemid)
	getPlayerSoul(cid)
	getPlayerAccountId(cid)
	getPlayerAccount(cid)
	getPlayerIp(cid)
	getPlayerFreeCap(cid)
	getPlayerLight(cid)
	getPlayerSlotItem(cid, slot)
	getPlayerWeapon(cid[, ignoreAmmo])
	getPlayerItemById(cid, deepSearch, itemId[, subType])
	getPlayerDepotItems(cid, depotid)
	getPlayerGuildId(cid)
	getPlayerGuildName(cid)
	getPlayerGuildRank(cid)
	getPlayerGuildNick(cid)
	getPlayerGuildLevel(cid)
	getPlayerSex(cid)
	getPlayerLookDir(cid)
	getPlayerStorageValue(uid, valueid)
	getPlayerGUID(cid)
	getPlayerFlagValue(cid, flag)
	getPlayerCustomFlagValue(cid, flag)
	getPlayerPromotionLevel(cid)
	getPlayerGroupId(cid)
	getPlayerLearnedInstantSpell(cid, name)
	getPlayerInstantSpellCount(cid)
	getPlayerInstantSpellInfo(cid, index)
	getPlayerSex(cid)
	getPlayerBlessing(cid, blessing)
	getPlayerStamina(cid)
	getPlayerNoMove(cid)
	getPlayerExtraExpRate(cid)
	getPlayerPartner(cid)
	getPlayerParty(cid)
	getPlayerPremiumDays(cid)
	getPlayerBalance(cid)
	getPlayerRedSkullTicks(cid)
	getInstantSpellInfoByName(cid, name)
	getInstantSpellWords(name)
	getPlayersByAccountId(accountNumber)
	getPlayersByIp(ip[, mask = 0xFFFFFFFF])
	getPlayersOnline()
	getPartyMembers(lid)
	getAccountIdByName(name)
	getAccountByName(name)
	getAccountIdByAccount(accName)
	getIpByName(name)
	getItemRWInfo(uid)
	getItemDescriptionsById(itemid)
	getItemNameById(itemid)
	getItemPluralNameById(itemid)
	getItemArticleById(itemid)
	getItemWeightById(itemid, count[, precise])
	getItemDescriptions(uid)
	getItemName(uid)
	getItemPluralName(uid)
	getItemArticle(uid)
	getItemWeight(uid[, precise])
	getItemAttack(uid)
	getItemExtraAttack(uid)
	getItemDefense(uid)
	getItemExtraDefense(uid)
	getItemArmor(uid)
	getItemAttackSpeed(uid)
	getItemHitChance(uid)
	getItemIdByName(name)
	getFluidSourceType(type)
	getContainerSize(uid)
	getContainerCap(uid)
	getContainerCapById(itemid)
	getContainerItem(uid, slot)
	getDepotId(uid)
	getTileItemById(pos, itemId[, subType])
	getTileItemByType(pos, type)
	getTileThingByPos(pos)
	getTilePzInfo(pos)
	getTileHouseInfo(pos)
	getTopCreature(pos)
	getClosestFreeTile(cid, targetpos[, extended[, ignoreHouse]])
	getThingFromPos(pos)
	getThing(uid)
	getThingPos(uid)
	getHouseOwner(houseid)
	getHouseName(houseid)
	getHouseEntry(houseid)
	getHouseRent(houseid)
	getHousePrice(houseid)
	getHouseTown(houseid)
	getHouseAccessList(houseid, listid)
	getHouseByPlayerGUID(playerGUID)
	getHouseTilesSize(houseid)
	getTownId(townName)
	getTownName(townId)
	getTownTemplePosition(townId)
	getTownHouses(townId)
	getWorldType()
	getWorldTime()
	getWorldLight()
	getWorldCreatures(type) //0 players, 1 monsters, 2 npcs, 3 all
	getWorldUpTime()
	getHighscoreString(skillId)
	getVocationInfo(id)
	getGuildId(guildName)
	getSpectators(centerPos, rangex, rangey, multifloor)
	getSearchString(fromPosition, toPosition[, isPlayer])
	getNotationsCound(accId)
	getBanData(value)
	getBanList(type[, value])
	getBanReason(id)
	getBanAction(id[, ipBanishment])
	getGlobalStorageValue(valueid)
	getConfigFile()
	getLogsDir()
	getDataDir()

	//set*
	setCreatureMaxHealth(cid, health)
	setCreatureMaxMana(cid, mana)
	setPlayerStorageValue(uid, valueid, newvalue)
	setPlayerGroupId(cid, newGroupId)
	setPlayerPromotionLevel(cid, level)
	setPlayerStamina(cid, minutes)
	setPlayerExtraExpRate(cid, value)
	setPlayerPartner(cid, guid)
	setHouseOwner(houseid, ownerGUID)
	setHouseAccessList(houseid, listid, listtext)
	setItemName(uid)
	setItemPluralName(uid)
	setItemIdArticle(uid)
	setItemAttack(uid, attack)
	setItemExtraAttack(uid, extraattack)
	setItemDefense(uid, defense)
	setItemArmor(uid, armor)
	setItemExtraDefense(uid, extradefense)
	setItemAttackSpeed(uid, attackspeed)
	setItemHitChance(uid, hitChance)
	setCombatArea(combat, area)
	setCombatCondition(combat, condition)
	setCombatParam(combat, key, value)
	setConditionParam(condition, key, value)
	setCombatCallBack(combat, key, function_name)
	setCombatFormula(combat, type, mina, minb, maxa, maxb)
	setConditionFormula(combat, mina, minb, maxa, maxb)
	setGlobalStorageValue(valueid, newvalue)
	setWorldType(type)

	//do*
	doCreatureAddHealth(cid, health[, force])
	doCreatureAddMana(cid, mana)
	doCreatureSetDropLoot(cid, doDrop)
	doCreatureSetSkullType(cid, skull)
	doCreatureChangeOutfit(cid, outfit)
	doCreatureSay(cid, text, type[, pos])
	doSetCreatureLight(cid, lightLevel, lightColor, time)
	doSetCreatureOutfit(cid, outfit, time)
	doRemoveCreature(cid)
	doMoveCreature(cid, direction)
	doSummonCreature(name, pos)
	doConvinceCreature(cid, target)
	doChallengeCreature(cid, target)
	doChangeSpeed(cid, delta)
	doMonsterChangeTarget(cid)
	doMonsterSetTarget(cid, target)
	doSetMonsterOutfit(cid, name, time)
	doPlayerBroadcastMessage(cid, message[, type])
	doPlayerSetSex(cid, newSex)
	doPlayerSetTown(cid, townid)
	doPlayerSetVocation(cid,voc)
	doPlayerRemoveItem(cid, itemid, count[, subtype])
	doPlayerAddExp(cid, exp)
	doPlayerSetGuildId(cid, id)
	doPlayerSetGuildRank(cid, rank)
	doPlayerSetGuildNick(cid, nick)
	doPlayerAddOutfit(cid,looktype, addons)
	doPlayerRemoveOutfit(cid,looktype, addons)
	doPlayerSetRedSkullTicks(cid, amount)
	doPlayerSetLossPercent(cid, lossType, newPercent)
	doPlayerSetLossSkill(cid, doLose)
	doPlayerAddSkillTry(cid, skillid, n)
	doPlayerAddSpentMana(cid, amount)
	doPlayerAddSoul(cid, soul)
	doPlayerAddItem(uid, itemid[, count/subtype[, canDropOnMap]])
	doPlayerAddItemEx(cid, uid[, canDropOnMap])
	doPlayerSendTextMessage(cid, MessageClasses, message)
	doPlayerAddMoney(cid, money)
	doPlayerRemoveMoney(cid, money)
	doPlayerWithdrawMoney(cid, money)
	doPlayerDepositMoney(cid, money)
	doPlayerTransferMoneyTo(cid, target, money)
	doPlayerPopupFYI(cid, message)
	doPlayerSendTutorial(cid, id)
	doPlayerAddMapMark(cid, pos, type[, description])
	doPlayerAddPremiumDays(cid, days)
	doPlayerAddBlessing(cid, blessing)
	doPlayerAddStamina(cid, minutes)
	doPlayerSetNoMove(cid, cannotMove)
	doPlayerResetIdleTime(cid)
	doPlayerLearnInstantSpell(cid, name)
	doPlayerFeed(cid, food)
	doPlayerSendCancel(cid, text)
	doPlayerSendDefaultCancel(cid, ReturnValue)
	doCreateItem(itemid, type/count, pos)
	doCreateItemEx(itemid[, count/subtype])
	doAddContainerItemEx(uid, virtuid)
	doAddContainerItem(uid, itemid[, count/subtype])
	doChangeTypeItem(uid, newtype)
	doDecayItem(uid)
	doRemoveItem(uid[, n])
	doTransformItem(uid, toitemid[, count/subtype])
	doSetItemActionId(uid, actionid)
	doSetItemText(uid, text)
	doSetItemSpecialDescription(uid, desc)
	doSetItemOutfit(cid, item, time)
	doTileAddItemEx(pos, uid)
	doAddCondition(cid, condition)
	doRemoveCondition(cid, type)
	doAreaCombatHealth(cid, type, pos, area, min, max, effect)
	doTargetCombatHealth(cid, target, type, min, max, effect)
	doAreaCombatMana(cid, pos, area, min, max, effect)
	doTargetCombatMana(cid, target, min, max, effect)
	doAreaCombatCondition(cid, pos, area, condition, effect)
	doTargetCombatCondition(cid, target, condition, effect)
	doAreaCombatDispel(cid, pos, area, type, effect)
	doTargetCombatDispel(cid, target, type, effect)
	doCombat(cid, combat, param)
	doTeleportThing(cid, newpos[, pushmove])
	doCreateTeleport(itemid, topos, createpos)
	doSendMagicEffect(pos, type[, creature])
	doSendDistanceShoot(frompos, topos, type[, creature])
	doSendAnimatedText(pos, text, color[, creature])
	doShowTextDialog(cid, itemid, text)
	doRelocate(pos, posTo)
	doBroadcastMessage(message, type)
	doAddIpBanishment(ip[, length[, comment[, admin]]])
	doAddNamelock(name[, reason[, action[, comment[, admin]]]])
	doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])
	doAddDeletion(accId[, reason[, action[, comment[, admin]]]]])
	doAddNotation(accId[, reason[, action[, comment[, admin]]]]])
	doRemoveIpBanishment(ip[, mask])
	doRemoveNamelock(name)
	doRemoveBanisment(accId)
	doRemoveDeletion(accId)
	doRemoveNotations(accId)


	//is*
	isCreature(cid)
	isMonster(uid)
	isNpc(uid)
	isPlayer(cid)
	isPlayerPzLocked(cid)
	isPlayerGhost(cid)
	isItemStackable(itemid)
	isItemRune(itemid)
	isItemDoor(itemid)
	isItemLevelDoor(itemid)
	isItemContainer(itemid)
	isItemFluidContainer(itemid)
	isItemMovable(itemid)
	isContainer(uid)
	isCorpse(uid)
	isMovable(uid)
	isSightClear(fromPos, toPos, floorCheck)
	isIpBanished(ip[, mask])
	isPlayerNamelocked(name)
	isAccountBanished(accId)
	isAccountDeleted(accId)
	isInArray({array}, value)

	//others
	registerCreatureEvent(uid, eventName)
	createCombatArea({area}[, {exArea}])
	createConditionObject(type)
	addDamageCondition(condition, rounds, time, value)
	addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
	createCombatObject()
	numberToVariant(number)
	stringToVariant(string)
	positionToVariant(pos)
	targetPositionToVariant(pos)
	variantToNumber(var)
	variantToString(var)
	variantToPosition(var)
	canPlayerLearnInstantSpell(cid, name)
	queryTileAddThing(uid, pos[, flags])
	canPlayerWearOutfit(cid, looktype, addons)
	executeRaid(name)
	saveServer()
	cleanHouse(houseId)
	cleanMap()
	shutdown()
	addEvent(callback, delay, ...)
	stopEvent(eventid)
	debugPrint(text)
	hasProperty(uid)

	//db table
	db.executeQuery(query)
	db.storeQuery(query)
	db.escapeString(str)
	db.escapeBlob(s, length)
	db.stringComparisonOperator()

	//result table
	result.getDataInt(resId, s)
	result.getDataLong(resId, s)
	result.getDataString(resId, s)
	result.getDataStream(resId, s, length)
	result.next(resId)
	result.free(resId)

	//bit table
	#bit.cast
	bit.bnot(n)
	bit.band(type, n)
	bit.bor(type, n)
	bit.bxor(type, n)
	bit.lshift(type, n)
	bit.rshift(type, n)
	#bit.arshift
	#bit.ucast
	bit.ubnot(n)
	bit.uband(type, n)
	bit.ubor(type, n)
	bit.ubxor(type, n)
	bit.ulshift(type, n)
	bit.urshift(type, n)
	#bit.uarshift

	//compats
	table.getPos = table.find
	doSetCreatureDropLoot = doCreatureSetDropLoot
	doPlayerSay = doCreatureSay
	doPlayerAddMana = doCreatureAddMana
	playerLearnInstantSpell = doPlayerLearnInstantSpell
	doPlayerRemOutfit = doPlayerRemoveOutfit
	pay = doPlayerRemoveMoney
	broadcastMessage = doBroadcastMessage
	getPlayerName = getCreatureName
	getPlayerPosition = getCreaturePosition
	getCreaturePos = getCreaturePosition
	creatureGetPosition = getCreaturePosition
	getPlayerMana = getCreatureMana
	getPlayerMaxMana = getCreatureMaxMana
	hasCondition = getCreatureCondition
	isMoveable = isMovable
	isItemMoveable = isItemMovable
	saveData = saveServer
	savePlayers = saveServer
	getPlayerSkill = getPlayerSkillLevel
	getPlayerSkullType = getCreatureSkullType
	getAccountNumberByName = getAccountIdByName
	getIPByName = getIpByName
	getPlayersByIP = getPlayersByIp
	getThingfromPos = getThingFromPos
	getPlayersByAccountNumber = getPlayersByAccountId
	getIPByPlayerName = getIpByName
	getPlayersByIPNumber = getPlayersByIp
	getAccountNumberByPlayerName = getAccountIdByName
	convertIntToIP = doConvertIntegerToIp

	//lua-made functions
	doPlayerGiveItem(cid, itemid, amount, subType)
	doPlayerTakeItem(cid, itemid, amount)
	doPlayerBuyItem(cid, itemid, count, cost, charges)
	doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
	doPlayerSellItem(cid, itemid, count, cost)
	isInRange(pos, fromPos, toPos)
	isPremium(cid)
	getMonthDayEnding(day)
	getMonthString(m)
	getArticle(str)
	isNumber(str)
	getDistanceBetween(firstPosition, secondPosition)
	doPlayerAddAddons(cid, addon)
	isSorcerer(cid)
	isDruid(cid)
	isPaladin(cid)
	isKnight(cid)
	isRookie(cid)
	getConfigInfo(info)
	getDirectionTo(pos1, pos2)
	getPlayerLookPos(cid)
	getPosByDir(fromPosition, direction, size)
	getPlayerMoney(cid)
	doPlayerWithdrawAllMoney(cid)
	doPlayerDepositAllMoney(cid)
	doPlayerTransferAllMoneyTo(cid, target)
	playerExists(name)
	getTibiaTime()
	doWriteLogFile(file, text)
	isInArea(pos, fromPos, toPos)
	getExperienceForLevel(lv)
	doMutePlayer(cid, time)
	getPlayerVocationName(cid)
	getPromotedVocation(vid)
	doPlayerRemovePremiumDays(cid, days)
	getPlayerMasterPos(cid)
	getOnlinePlayers()
	getPlayerByName(name)
	getPlayerFrags(cid)
	doConvertIntegerToIp(int, mask)
	getBooleanFromString(str)
	doCopyItem(item, attributes)
	exhaustion.check(cid, storage)
	exhaustion.get(cid, storage)
	exhaustion.set(cid, storage, time)
	exhaustion.make(cid, storage, time)
	table.find(table, value)
	table.isStrIn(txt, str)
	table.countElements(table, item)
	table.getCombinations(table, num)
	string.split(str)
	string.trim(str)
	string.explode(str, sep)
]

Wow i don't even know that exists xD

Thank you very much again...

And about the server i'll try to test one 8.54.

http://otland.net/f18/8-54-forgotten-server-0-3-6-crying-damson-59924/

That one is good?
 
Yes, that'd work.

Also;

Lua:
  local config = {
        x = 1333,
        y = 1334,
        z = 1335
}

function onSay(cid, words, param, channel)

        if words == '/c' then
                        if(param == "") then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                                return TRUE
                        end

                        local target = getPlayerByNameWildcard(param)
                        if(target == 0) then
                                target = getCreatureByName(param)
                                if(target == 0) then
                                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
                                        return TRUE
                                end
                        end

                        if(isPlayer(target) == TRUE and isPlayerGhost(target) == TRUE and getPlayerAccess(target) > getPlayerAccess(cid)) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
                                return TRUE
                        end

                        local pos = getClosestFreeTile(target, getCreaturePosition(cid))
                        if(pos == LUA_ERROR or isInArray({pos.x, pos.y, pos.z}, 0) == TRUE) then
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
                                return TRUE
                        end

                        local tmp = getCreaturePosition(target)
                        setPlayerStorageValue(target, config.x, getCreaturePosition(target).x)
                        setPlayerStorageValue(target, config.y, getCreaturePosition(target).y)
                        setPlayerStorageValue(target, config.z, getCreaturePosition(target).z)
                        if(doTeleportThing(target, pos, TRUE) ~= LUA_ERROR and isPlayerGhost(target) ~= TRUE) then
                                doSendMagicEffect(tmp, CONST_ME_POFF)
                                doSendMagicEffect(pos, CONST_ME_TELEPORT)
                        end
                       
        else
       
                if(param == '') then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                        return true
                end

                local pid = getPlayerByNameWildcard(param)
                if(pid == 0 or (isPlayerGhost(pid) and getPlayerAccess(pid) > getPlayerAccess(cid))) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                        return true
                end

                local player = getPlayerByNameWildcard(param)
                local pos = {x = 0, y = 0, z = 0}

                if getPlayerStorageValue(pid, config.x) ~= -1 then
                        pos = {x = getPlayerStorageValue(pid, config.x), y = getPlayerStorageValue(pid, config.y), z = getPlayerStorageValue(pid, config.z)}
                        setPlayerStorageValue(pid, config.x, -1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player has not been summoned.")
                        return true
                end

                if(pos == LUA_ERROR or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
                        return true
                end

                pos = getClosestFreeTile(cid, pos, true)
                if(pos == LUA_ERROR or isInArray({pos.x, pos.y}, 0)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
                        return true
                end

                local tmp = getCreaturePosition(pid)
                if(doTeleportThing(pid, pos, true) and isPlayerGhost(pid) == 0) then
                        doSendMagicEffect(tmp, CONST_ME_POFF)
                        doSendMagicEffect(pos, CONST_ME_TELEPORT)
                end
        end
        return true
end

I think that should work.
 
/addoutfit John, 132, 2

Lua:
function onSay(cid, words, param, channel)  
	if(param ~= "")then
            local params = list({"name", "outfit", "addon"}, string.explode(param, " ", 3))
            local player = getPlayerByName(params["name"])
            if(isPlayer(player) == true)then
                local addon = (params["outfit", "addon"])
		if (getNotationsCount(getPlayerAccount(player)) < 1) then
		    doPlayerAddOutfit(player, addons)
		    doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved a new outfit from ".. getCreatureName(cid) ..".")
		    doSendMagicEffect(getCreaturePosition(player), CONST_ME_GIFT_WRAPS)
		else
		    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "This player has to many notations to recieve this outfit.")
		end
	    else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "This player is not online.")
	    end
	else
	    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Command requires param.")
	end
	return true
end
 
Last edited:
Back
Top Bottom