function onSay(cid, words, param, channel)
local minLevelToTeleportPlayers = 40
local maxLevelOfNoobToTeleport = 39
local townID = getPlayerTown(cid)
local temple = getTownTemplePosition(townID)
local pid = 0
if(param == '') then
pid = getCreatureTarget(cid)
if(pid == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to pick someone to teleport.")
return true
end
else
pid = getPlayerByNameWildcard(param)
end
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Player " .. param .. " is not currently online.")
return true
end
if(isPlayer(pid) and getPlayerLevel(cid) < minLevelToTeleportPlayers) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot send people to temple until at least level " .. minLevelToTeleportPlayers .. ".")
return true
end
if(isPlayer(pid) and getPlayerLevel(pid) > maxLevelOfNoobToTeleport) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You cannot teleport this player.")
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been teleported.")
doTeleportThing(pid, temple)
db.executeQuery("UPDATE players SET soul = soul - 30 WHERE id = "..getPlayerGUID(cid)..";")
return true
end