function onSay(cid, words, param, channel)
local config ={
skull = "no", -- players podem estar com skull? ("yes" or "no").
protection_zone = "no", -- players precisam estar em protection zone? ("yes" or "no").
battle = "yes" -- players precisam estar sem fight? ("yes" or "no").
}
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local tid = cid
local t = string.explode(param, ",")
if(t[2]) then
tid = getPlayerByNameWildcard(t[2])
if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
local tmp = t[1]
if(not tonumber(tmp)) then
tmp = getTownId(tmp)
if(not tmp) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
return true
end
end
local pos = getTownTemplePosition(tmp, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
return true
end
pos = getClosestFreeTile(tid, pos)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
return true
end
if(config.skull == "no") and (getCreatureSkullType(cid) >= 3) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "apenas players sem skulls podem usar este comando.")
elseif(config.protection_zone == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"você precisa estar em protection zone para usar este comando.")
elseif(config.battle == "yes") and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você precisa estar sem battler para usar este comando.")
return TRUE
end
tmp = getCreaturePosition(tid)
if(doTeleportThing(tid, pos, true) and not isPlayerGhost(tid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return TRUE
end
4
1.4k
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

23 de setembro de 2010 às 13:06
Editado Setembro 23 por Vodkart
23 de setembro de 2010 às 13:16
Agradeço. ^^





info
Grupo: Campones
Registrado: 09/10/08
Posts: 12
Reputação: 0
Eu libero o /town para os players, mas gostaria de saber como fazer para que esse comando não desse para usar em modo de batalha, para evitar fujões de "PKs".
Meu script é assim.
Editado Setembro 23 por Akuron