ok so finally i added the cast system to OTHire engine 0.0.3 and for now it seems to work, now i have a problem with it, when i type..
!cast (it gives me a debug in the client, and it is supposed to tell me something like this -->Parameters needed)
!cast on ( 18:15 Cast has started. so now when i try to test it with mc it gives me a client debug and ingame i see this with the owner of the cast, ---> 18:15 Spectator 1 has joined the cast.)
!cast off (it ends normal no errors with it)
!cast status (give me a error in the console) so i wont explain all the commands here because most of them give me debug and there are like 2 or 3 working.. i hope someone can help me please?
this is the cast talkaction
and this is the debug from the client
!cast (it gives me a debug in the client, and it is supposed to tell me something like this -->Parameters needed)
!cast on ( 18:15 Cast has started. so now when i try to test it with mc it gives me a client debug and ingame i see this with the owner of the cast, ---> 18:15 Spectator 1 has joined the cast.)
!cast off (it ends normal no errors with it)
!cast status (give me a error in the console) so i wont explain all the commands here because most of them give me debug and there are like 2 or 3 working.. i hope someone can help me please?
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/cast.lua:onSay
internalGetPlayerInfo(). Player not found. info = 25
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/cast.lua:onSay
luaGetPlayerCastViewers(). Creature not found
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/cast.lua:onSay
data/talkactions/scripts/cast.lua:144: bad argument #1 to 'pairs' (table expected, got boolean)
stack traceback:
[C]: in function 'pairs'
data/talkactions/scripts/cast.lua:144: in function <data/talkactions/scripts/cast.lua:1>
this is the cast talkaction
Code:
function onSay(cid, words, param)
local tmp = param:explode(" ")
if not(tmp[1]) then
return doPlayerSendCancel(cid, "Parameters needed")
end
-- Cast ON
if tmp[1] == "on" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.")
doPlayerSetCastState(cid, true)
doSavePlayer(cid)
elseif getPlayerCast(cid).status == false then
return doPlayerSendCancel(cid, "Your cast has to be running for this action.")
-- Cast OFF
elseif tmp[1] == "off" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.")
doPlayerSetCastState(cid, false)
doSavePlayer(cid)
-- Set Cast Password
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
-- Set Cast Description
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)
-- Ban Cast Spectators
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
-- UnBan Cast Spectators
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
-- Get Cast Banned Spectators
elseif param == "bans" then
local t = getPlayerCastBan(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)
-- Mute Cast Spectators
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
-- Unmute Cast Spectators
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
-- Get Cast Muted Spectators
elseif param == "mutes" then
local t = getPlayerCastMutes(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)
-- Get Cast Viewers
elseif param == "viewers" then
local t = getPlayerCastViewers(cid, getPlayerIp())
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)
-- Get Cast Status
elseif param == "status" then
local t, c = getPlayerCastViewers(cid, getPlayerIp()), 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.."'"))
-- Update Cast Settings
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
doSavePlayer(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.")
setPlayerStorageValue(cid, 656544, os.time() + 60)
end
return false
end
and this is the debug from the client
Code:
+---------------------------------------------------------------
Debug Assertion 7.72 Communication.cpp 2461
Mon Sep 17 18:18:11 2018
Windows Version: 6.2 build 9200 on 2
Graphic Engine: 2
Last Packet Types: 170 180 109 109 030 109 109 030 109 180
Last Packet: 070 000 180 023 026 000 089 111 117 032 110 101 101 100 032 116
Player Position: [32368,32220,7]
Player.cpp 383: exception occurred, reason:
Network.cpp 885: exception occurred (ErrorCode = 0), reason:
Control.cpp 1280: exception occurred (Type = 170), reason:
Communication.cpp 2466: exception occurred (Mode = 100) (Channel = 0), reason:
Communication.cpp 2461: unknown talk mode (Mode = 100), reason:
[bug0000649]
----------------------------------------------------------------
Last edited: