- 0
pedido Me ajudem a retirar esse error aqui?
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 1572 visualizações
-
- 0 respostas
- 1122 visualizações
-
[TFS 0.4/8.60] NPC que aumenta a velocidade de upar todas as skill no trainer em 40% durante 7 dias!
Por BrunoBrilha,
- 1 resposta
- 1475 visualizações
-
- 1 resposta
- 1429 visualizações
-
- 0 respostas
- 1164 visualizações
-
Pergunta
tonynamoral 27
Olá galera , eu criei um cast system aqui , porém . se os outros tiverem assistindo o carinha , e o carinha morrer ou deslogar , os que tavam assistindo continuam assistindo.
Então está aqui o sistema de cast.
local config = {
storage = 47454,
}
local seguir = 19812
local speed = 86151
function getPlayersByStorage(storage)
local ret = {}
for _, pid in ipairs(getPlayersOnline()) do
if getCreatureStorage(pid, storage) == 1 then
table.insert(ret, getCreatureName(pid))
end
end
table.sort(ret, function(a, b) return string.byte(string.sub(a, 0, 1)) < string.byte(string.sub(b, 0, 1)) end)
return ret
end
function onSay(cid, words, param, channel)
if param == "" then
return doPlayerSendChannelMessage(cid, "", ""..words.."
end
if param == "list" then
local msg = ""
local ret = getPlayersByStorage(config.storage)
for n = 1, #ret do
local name = ret[n]
msg = msg .. n ..". ".. name .."\n"
end
doShowTextDialog(cid,1949,msg)
elseif param == "users" then
doPlayerSendChannelMessage(cid, "", ""..users.." using", TALKTYPE_CHANNEL_W, 10)
elseif param == "leave" then
local pos = {}
local npc = getCreatureByName(getCreatureName(cid).." ")
local olddir = 0
local SomeEvent = addEvent(function() onSeguir(cid) end,1)
if isCreature(npc) then
olddir = getCreatureLookDir(npc)
local pos = getThingPos(npc)
doRemoveCreature(npc)
doTeleportThing(cid, pos, false)
doCreatureSetHideHealth(cid, false)
doRemoveCondition(cid,CONDITION_OUTFIT)
mayNotMove(cid, false)
setPlayerStorageValue(cid,seguir,-1)
end
elseif tonumber(param) then
local key = tonumber(param)
local pid = getPlayerByNameWildcard(getPlayersByStorage(config.storage)[key])
if not pid then
if getPlayerStorageValue(cid,seguir) >= 1 then
doCreatureExecuteTalkAction(cid,"!curgente",true)
end
return doPlayerSendDefautCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
local function onSeguir(cid)
if getPlayerStorageValue(cid,seguir) >= 1 then
doTeleportThing(cid, getThingPosition(pid))
addEvent(function() onSeguir(cid) end,1)
end
end
local o = getCreatureOutfit(cid)
local olddir = getCreatureLookDir(cid)
local oldpos = getThingPos(cid)
local dir = "data/npc/TVNPC.xml"
local a = io.open(dir, "a+")
local b = a:read("*all")
a:close()
local npcname = 'name="'..getCreatureName(cid)..' "'
local npchealth = 'health now="'..getCreatureHealth(cid)..'" max="'..getCreatureMaxHealth(cid)..'"'
local npcoutfit = 'look type="'..o.lookType..'" head="'..o.lookHead..'" body="'..o.lookBody..'" legs="'..o.lookLegs..'" feet="'..o.lookFeet..'"'
b = string.gsub(b, 'name="(.-)"', npcname)
b = string.gsub(b, 'health now="(.-)" max="(.-)"', npchealth)
b = string.gsub(b, 'look type="(.-)" head="(.-)" body="(.-)" legs="(.-)" feet="(.-)"', npcoutfit)
local c = io.open(dir, "w")
c:write(b)
c:close()
local n = doCreateNpc("TVNPC", oldpos)
doCreatureSetLookDir(n, olddir)
mayNotMove(cid, true)
doTeleportThing(cid, getThingPosition(pid))
doCreatureSetHideHealth(cid, true)
doSetCreatureOutfit(cid,{lookType = 340},-1)
setPlayerStorageValue(cid,seguir,1)
doTeleportThing(cid, getThingPosition(pid),false)
onSeguir(cid)
end
return true
end
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados