Ir para conteúdo

Featured Replies

Postado

 

Seguinte... alguém sabe qual o motivo o cast system não atualiza o banco de dados quando dou o comando /cast on?? tudo funciona perfeitamente, só não atualiza o banco para mostrar no site...

 

  • Respostas 6
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Não precisa alterar a source, da pra fazer em Lua mesmo. Não é um problema exclusivo do cast do summ, o do elf também é necessário script pra atualizar os viewers.

  • @yazanki com base no que o WooX disse, e pelo que eu e ele conversamos. Fiz um script que testei aqui e funcionou perfeitamente. Ele verifica se há jogadores online no cast, se tiver ele irá executar

Postado
  • Autor
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)
     db.query("UPDATE players SET cast=1 WHERE id="..getPlayerGUID(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)
         db.query("UPDATE players SET cast=0 WHERE id="..getPlayerGUID(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: \""..d.."\"")
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d)
     doPlayerSetCastDescription(cid, d)
     db.query("UPDATE players SET castDescription='"..d.."' WHERE id="..getPlayerGUID(cid))
   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

Pesquisando aqui, achei isso, só que ele não tá adicionando a quantidade de Viewers...

Postado

Seguinte, a questão é facil de responder. Para as informações atualizarem é necessario de um save. Por isso o cast do summ que no caso é o que você utiliza tem o comando /cast update , assim ele atualiza as informações! Vi que você já resolveu a respeito do /cast on, sobre os Viewers creio que teria que mexer na propria source para funcionar de imediato, creio que o Summ não fez isso por conta que poderia causar muito leg, assim ocasiando a um crash. Então toda vez que quiser atualizar as informações, basta usar o comando /cast update.

Editado por Yan Liima (veja o histórico de edições)

════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═══╗

Te Ajudei? Rep + e ficamos Quits

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Postado
14 horas atrás, Yan Liima disse:

Seguinte, a questão é facil de responder. Para as informações atualizarem é necessario de um save. Por isso o cast do summ que no caso é o que você utiliza tem o comando /cast update , assim ele atualiza as informações! Vi que você já resolveu a respeito do /cast on, sobre os Viewers creio que teria que mexer na propria source para funcionar de imediato, creio que o Summ não fez isso por conta que poderia causar muito leg, assim ocasiando a um crash. Então toda vez que quiser atualizar as informações, basta usar o comando /cast update.

 

Não precisa alterar a source, da pra fazer em Lua mesmo. Não é um problema exclusivo do cast do summ, o do elf também é necessário script pra atualizar os viewers.

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo