Ir para conteúdo
  • Cadastre-se

Posts Recomendados

[20:57:16.589] Description: 
[20:57:16.589] data/talkactions/scripts/cast.lua:9: attempt to call global 'doPlayerSetCastState' (a nil value)
 
 
Pessoal está aparecendo esse erro, e o spectator fica se desconectando, alguem poderia me dizer e resolver isso pra mim? Obrigado!
Link para o post
Compartilhar em outros sites

 

function onSay(cid, words, param, channel)

local tmp = param:explode(" ")
if not(tmp[1]) then
return doPlayerSendCancel(cid, "Parameters needed")
end
 
if tmp[1] == "on" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.")
doPlayerSetCastState(cid, true)
doPlayerSave(cid)
elseif getPlayerCast(cid).status == false then
return doPlayerSendCancel(cid, "Your cast has to be running for this action.")
elseif tmp[1] == "off" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.")
doPlayerSetCastState(cid, false)
doPlayerSave(cid)
elseif isInArray({"pass", "password", "p"}, tmp[1]) then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "You need to set a password")
end
 
if tmp[2]:len() > 10 then
return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)")
end
 
if tmp[2] == "off" then
doPlayerSetCastPassword(cid, "")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.")
else
doPlayerSetCastPassword(cid, tmp[2])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2])
end
elseif isInArray({"desc", "description", "d"}, tmp[1]) then
local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "")
 
if not(d) or d:len() == 0 then
return doPlayerSendCancel(cid, "You need to specify a description.")
end
 
if d:len() > 50 then
return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)")
end
 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d)
doPlayerSetCastDescription(cid, d)
elseif tmp[1] == "ban" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.")
end
 
if doPlayerAddCastBan(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.")
end
elseif tmp[1] == "unban" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify the person you want to unban.")
end
 
if doPlayerRemoveCastBan(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.")
end
elseif param == "bans" then
local t = getCastBans(cid)
local text = "Cast Bans:\n\n"
for k, v in pairs(t) do
text = text .. "*" .. v.name .. "\n"
end 
if text == "Cast Bans:\n\n" then
text = text .. "No bans."
end
doShowTextDialog(cid, 5958, text)
elseif tmp[1] == "mute" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.")
end
 
if doPlayerAddCastMute(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.")
end
elseif tmp[1] == "unmute" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify the person you want to unmute.")
end
 
if doPlayerRemoveCastMute(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.")
end
elseif param == "mutes" then
local t = getCastMutes(cid)
local text = "Cast Mutes:\n\n"
for k, v in pairs(t) do
text = text .. "*" .. v.name .. "\n"
end 
if text == "Cast Bans:\n\n" then
text = text .. "No mutes."
end
doShowTextDialog(cid, 5958, text)
elseif param == "viewers" then
local t = getCastViewers(cid)
local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0
for _,v in pairs(t) do
count = count + 1
text = text .. "*" .. v.name .."\n"
end
 
if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end
text = text:gsub("|COUNT|", count)
doShowTextDialog(cid, 5958, text)
elseif param == "status" then
local t, c = getCastViewers(cid), getPlayerCast(cid)
local count = 0
for _,v in pairs(t) do count = count + 1 end
 
doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n      " .. count .. "\n*Description:\n      "..(c.description == "" and "Not set" or c.description).."\n*Password:\n      " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'"))
elseif param == "update" then
if getPlayerStorageValue(cid, 656544) > os.time() then
return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.")
end
doPlayerSave(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.")
doPlayerSetStorageValue(cid, 656544, os.time()+60)
end
return true
end

Obrigado por responder Phodarks

Link para o post
Compartilhar em outros sites

Faça um backup deste script e tente utilizar este :

function onSay(cid, words, param)
local player = getPlayerByName(param)


if not isInArray({"list", "exit", "off", "on"}, param) and not param or param == "" then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "Enter the name of the player, which you want to cast in parameters.")
    return true
end

if param == "on" then

if getPlayerStorageValue(cid, 10359) >= 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "Your Cast System is already running ONLINE!")
    return true
end

    castOn(cid)
    doSendMagicEffect(getThingPos(cid), 39)
    doPlayerSendTextMessage(cid, 20, "You have activated your Cast System, now others can cast you, to disable this feature, use the parameter '!cast off'.")
    return true
end

if param == "off" then

    if getPlayerStorageValue(cid, 10359) < 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "Your Cast System is already OFFLINE!")
    return true
end

    castOff(cid)
    doSendMagicEffect(getThingPos(cid), 39)
    doPlayerSendTextMessage(cid, 20, "You have disabled your Cast System, from now on no one can watch you, unless you turn on the Cast, using the parameter '!cast on'.")
    return true
end

if param == "exit" then

    if getPlayerStorageValue(cid, 12269) < 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "You no are casting players.")
    return true
end

    cancelCast(cid)
    doSendMagicEffect(getThingPos(cid), 39)
    doPlayerSendTextMessage(cid, 20, "You stopped casting, use the parameter '!cast list' to see who can be casted.")
    return true
end

if param == "list" then

    if #whoCasted() < 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "At this time, no player can be casted, try again later.")
    return true
end

    doPlayerSendTextMessage(cid, 20, "Players can be casteds:\n\n")
    for k, v in ipairs(whoCasted()) do
    doPlayerSendTextMessage(cid, 20, " - "..getCreatureName(v).."")
end            

    return true
end

if not isPlayer(player) then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "This player is offline or does not exist. Use the parameter '!cast list' to see who can be casted.")
    return true
end

if getPlayerStorageValue(player, 10359) < 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "You can only cast one person with the Cast System is activated, use the parameter '!cast list' to see who can be assisted.")
    return true
end

if getPlayerStorageValue(cid, 10359) >= 1 then
    doSendMagicEffect(getThingPos(cid), 2)
    doPlayerSendTextMessage(cid, 20, "To cast a player, you must first disable your Cast System using the parameter '!cast off'.")
    return true
end

if not getTileInfo(getThingPos(cid)).protection then
    return doPlayerSendTextMessage(cid, 20, "You need enter in Protection Zone to use the Cast System.") and true
end

    setPlayerStorageValue(cid, 12269, 1)
    castPlayer(cid, player)
    doSendMagicEffect(getThingPos(cid), 39)
    doPlayerSendTextMessage(cid, 20, "You are casting the player "..getCreatureName(player)..", to exit just use the command '!cast exit'.")
    doPlayerSendTextMessage(player, 20, "You are casted by "..getCreatureName(cid).." player to disable your Cast, simply use the parameter '!cast off'.")
    return true
end

function cancelCast(uid)

mayNotMove(uid, false)
    doCreatureSetHideHealth(uid, false)
    setPlayerStorageValue(uid, 12269, -1)
    doRemoveCondition(uid, CONDITION_OUTFIT)                                                
    return doTeleportThing(uid, getTownTemplePosition(getPlayerTown(uid))) or doTeleportThing(uid, getPlayerMasterPos(uid)) and true
end

function castOn(uid)
    return setPlayerStorageValue(uid, 10359, 1) and true
end

function castOff(uid)
    return setPlayerStorageValue(uid, 10359, -1) and true
end

function castPlayer(uid, player)
if not isPlayer(player) then
    cancelCast(uid)
    return true
end

if getPlayerStorageValue(player, 10359) < 1 then
    cancelCast(uid)
    return true
end

if getPlayerStorageValue(uid, 12269) < 1 then
    cancelCast(uid)
    return true
end

mayNotMove(uid, true)
    doSetItemOutfit(uid, 1934, -1)
    doCreatureSetHideHealth(uid, true)
    doTeleportThing(uid, getThingPos(player))
    return addEvent(castPlayer, 1 * 1000, uid, player) and true
end

function whoCasted()
local casteds = {}

for _, pid in ipairs(getPlayersOnline()) do
    if getPlayerStorageValue(pid, 10359) >= 1 then
    table.insert(casteds, pid)
end
end

    return #casteds > 0 and casteds or {}
end
Link para o post
Compartilhar em outros sites

O principal problema é que quando um player fala: /cast on ele não abre o channel e também fica desconectando o spectator em pouco mais de 5 segundos.

Link para o post
Compartilhar em outros sites
  • 11 months later...

msm problema

Venha para a evolução do mapa HEROSERV -- Versão 8.60 -

Faça parte dessa família: http://kaiakserv.com

 

Link para o post
Compartilhar em outros sites
  • 7 months later...

Alguem me ajuda? Estou com este problema.

 

meu cast.lua:

function onSay(cid, words, param, channel)
local tmp = param:explode(" ")
if not(tmp[1]) then
return doPlayerSendCancel(cid, "Parameters needed")
end
 
if tmp[1] == "on" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.")
doPlayerSetCastState(cid, true)
doPlayerSave(cid)
elseif getPlayerCast(cid).status == false then
return doPlayerSendCancel(cid, "Your cast has to be running for this action.")
elseif tmp[1] == "off" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.")
doPlayerSetCastState(cid, false)
doPlayerSave(cid)
elseif isInArray({"pass", "password", "p"}, tmp[1]) then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "You need to set a password")
end
 
if tmp[2]:len() > 10 then
return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)")
end
 
if tmp[2] == "off" then
doPlayerSetCastPassword(cid, "")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.")
else
doPlayerSetCastPassword(cid, tmp[2])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2])
end
elseif isInArray({"desc", "description", "d"}, tmp[1]) then
local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "")
 
if not(d) or d:len() == 0 then
return doPlayerSendCancel(cid, "You need to specify a description.")
end
 
if d:len() > 50 then
return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)")
end
 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d)
doPlayerSetCastDescription(cid, d)
elseif tmp[1] == "ban" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.")
end
 
if doPlayerAddCastBan(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.")
end
elseif tmp[1] == "unban" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify the person you want to unban.")
end
 
if doPlayerRemoveCastBan(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.")
end
elseif param == "bans" then
local t = getCastBans(cid)
local text = "Cast Bans:\n\n"
for k, v in pairs(t) do
text = text .. "*" .. v.name .. "\n"
end 
if text == "Cast Bans:\n\n" then
text = text .. "No bans."
end
doShowTextDialog(cid, 5958, text)
elseif tmp[1] == "mute" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.")
end
 
if doPlayerAddCastMute(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.")
end
elseif tmp[1] == "unmute" then
if not(tmp[2]) then
return doPlayerSendCancel(cid, "Specify the person you want to unmute.")
end
 
if doPlayerRemoveCastMute(cid, tmp[2]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.")
end
elseif param == "mutes" then
local t = getCastMutes(cid)
local text = "Cast Mutes:\n\n"
for k, v in pairs(t) do
text = text .. "*" .. v.name .. "\n"
end 
if text == "Cast Bans:\n\n" then
text = text .. "No mutes."
end
doShowTextDialog(cid, 5958, text)
elseif param == "viewers" then
local t = getCastViewers(cid)
local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0
for _,v in pairs(t) do
count = count + 1
text = text .. "*" .. v.name .."\n"
end
 
if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end
text = text:gsub("|COUNT|", count)
doShowTextDialog(cid, 5958, text)
elseif param == "status" then
local t, c = getCastViewers(cid), getPlayerCast(cid)
local count = 0
for _,v in pairs(t) do count = count + 1 end
 
doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n      " .. count .. "\n*Description:\n      "..(c.description == "" and "Not set" or c.description).."\n*Password:\n      " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'"))
elseif param == "update" then
if getPlayerStorageValue(cid, 656544) > os.time() then
return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.")
end
doPlayerSave(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.")
doPlayerSetStorageValue(cid, 656544, os.time()+60)
end
return true
end

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo