I this thead is on wrong section please move IT ^^
Well, some times i start this project but i diceded stop it because i dont have time to finish and i dicided release it unfinished but working ^^
If you are noob on scripting its good dont go ahead ^^
This script 20% its an talkaction and anothers 80% it is a luaserver, this server it like IRC, you send and receive text only. you open with bearbot.exe, this is only for execute bearbot.lua and etc. (THIS IS A CHAT SERVER BETWEEN MANY SERVERS) on theses files its realy where is the server ;D
This server has some good stuffs, like, register names, block 2 clones, ignore, ban ip, close connection if has excess flood, check ping and many things! i go teach only how to config and use.
You can install talk with .luai on .rar attach~ or by yourserv uself:
Well lets config:
server Server IP (omg rlly?)
port Port
name Here you put your name (name of server will be good ^^)
name pass Here is the password, if you login at first time server will check you this name exist, if not exist it will crate for you on DB of server your name and your pass, if someone enter with your name the server will request you pass ^^
channel [Channel id where will be printed anithing
channel color text color
chat chat ID (from server)b 1 to otnet 2 to otland etc...
chat pass some channes request pass.
print ping to print ping status on console.
And now config from server
Ver version of the server (igore it)
work_on ignore too
chats Chats and config, (pass EVER will need to be *, set *string to a new pass.
luapass if client want execute a piece of lua code on server it will need send this pass
maxUsers max connections allowed.
if you are the server, execute bearbot.exe after config and finish! your server its running, send you IP to your friends connect!
If you are the client, enter on a GM adn say !conect (or a word in talkaction tag) and welldone you are connected!
now say !conect hello! to say hello! (open game chat)
;D
Evebody can edit it and if you want continue this project its okay just dont remove the credits ^^
some questions ask to me! (ps: talkaction requires OTAL)
Well, some times i start this project but i diceded stop it because i dont have time to finish and i dicided release it unfinished but working ^^
If you are noob on scripting its good dont go ahead ^^
This script 20% its an talkaction and anothers 80% it is a luaserver, this server it like IRC, you send and receive text only. you open with bearbot.exe, this is only for execute bearbot.lua and etc. (THIS IS A CHAT SERVER BETWEEN MANY SERVERS) on theses files its realy where is the server ;D
This server has some good stuffs, like, register names, block 2 clones, ignore, ban ip, close connection if has excess flood, check ping and many things! i go teach only how to config and use.
You can install talk with .luai on .rar attach~ or by yourserv uself:
Lua:
-- By mock
config = {
server = 'localhost',
port = 7172,
name = 'Mock',
name_pass = 'slsx450',
channel = 4, -- game chat (chat id)
channelcollor = TALKTYPE_CHANNEL_W,
chat = 1, -- 1 to otnet
chat_pass = '', --- if need set pass
printPing = true
}
function getInfo(cliente,pos,memory)
if clien == nil then
print(':: Connection closed!\a')
sendChannel('Connection closed. Finish chat. {err1}')
clien = nil
return
end
cliente:settimeout(0.1)
if memory.lastping <= os.clock() then
clien:send('!PING!\n')
memory.lastping = os.clock()+200
memory.w8ping = os.clock()+180
memory.w82ping = os.clock()
end
if memory.w8ping <= os.clock() then
print('::Ping timeout.\a')
sendChannel('Ping timeout.')
clien:close()
clien = nil
return
end
local a,b = clien:receive()
if a == nil and b ~= 'timeout' then
print(':: Connection closed!\a')
sendChannel('Connection closed. Finish chat. {err2}')
clien:close()
clien = nil
return
elseif a ~= nil then
if a:find('ERROR=(.+)') then
local err = a:match('ERROR=(.+)')
print('::\aError: '..err..'.')
return addEvent(getInfo,100,cliente,pos,memory)
elseif a:find('PONG') then
memory.lastping = os.clock()+90
memory.w8ping = os.clock()+180
memory.ping = math.floor(((os.clock()-memory.w82ping)*100))/100
if config.printPing == true then
print('PING: '..(memory.ping))
end
cliente:send('PING='..(memory.ping)..'\n')
return addEvent(getInfo,100,cliente,pos,memory)
elseif a:find('NOTICE=(.+) PLAYER=(.+)') then
msg, player = a:match('NOTICE=(.+) PLAYER=(.+)')
print(msg, player)
if isPlayer(tonumber(player or 0)) == TRUE and msg then
doPlayerSendToChannel(tonumber(player), tonumber(player), 13, msg, 4,0)
elseif msg and isPlayer(tonumber(player or 0)) == FALSE then
for i,cid in pairs(getPlayersOnline()) do
doPlayerSendToChannel(cid,cid, 13, msg, config.channel,0)
end
end
return addEvent(getInfo,100,cliente,pos,memory)
elseif a:find('MMNAME=(.+) UID=(.+)') then
local servername, myid = a:match('MMNAME=(.+) UID=(.+)')
memory.servername = servername
memory.id = myid
return addEvent(getInfo,100,cliente,pos,memory)
elseif a:find('TEXT=(.+)') then
sendChannel('<'..(memory.servername or '?')..'> '..a:match('TEXT=(.+)'))
return addEvent(getInfo,100,cliente,pos,memory)
else
return addEvent(getInfo,100,clien,pos,memory)
end
end
addEvent(getInfo,100,cliente,pos,memory)
end
function sendChannel(msg)
assert(msg,'msg is nil.')
for i,cid in pairs(getPlayersOnline()) do
doPlayerSendToChannel(cid, cid, config.channelcollor, msg, config.channel,0)
end
end
function onSay(cid, words, param)
if getPlayerGroupId(cid) > 3 and clien == nil then
setGlobalStorageValue(90903,os.clock()+2)
clien = socket.connect(config.server,config.port)
if clien then
clien:send('NAME='..config.name..' CHAT='..config.chat..' PASS=*'..(config.chat_pass)..' PASS2='..config.name_pass..' VERSION='..(0x12c)..'\n')
doCreatureSay(cid, 'connected!', 1)
clien:send('!PING!\n')
sendChannel('Connected. Starting chat.')
clien:settimeout(10)
a,kn = clien:receive()
if a ~= 'OK' then
clien:close()
clien = nil
if a == nil and kn ~= 'closed' then
print('::\aError: Unknow error.')
sendChannel('Error: Unknow error.')
sendChannel('Connection closed. Finish chat. {err3}')
return TRUE
elseif a == nil and kn == 'closed' then
print('::\aError: Unespected error, connection closed.')
sendChannel('Error: Unespected error, connection closed.')
sendChannel('Connection closed. Finish chat. {err3}')
return TRUE
elseif a:match('ERROR=(.+)') == nil then
print('::\aError: Unknow error. '..a..'.')
sendChannel('Error: Unknow error. '..a..'.')
sendChannel('Connection closed. Finish chat. {err3}')
return TRUE
else
sendChannel('Error: '..(a or "1"):match('ERROR=(.+)') ..'.')
print('::\aError: '..(a or "1"):match('ERROR=(.+)') ..'.')
sendChannel('Connection closed. Finish chat. {err3}')
return TRUE
end
return TRUE
end
local memory = {ping=0,lastping=os.clock()+30,w8ping=os.clock()+10,w82ping=os.clock()}
addEvent(getInfo,100,clien,pos,memory)
else
doCreatureSay(cid, 'Cant connect', 1)
end
end
if clien ~= nil and param ~= "" then
if getGlobalStorageValue(90903) < os.clock() then
if param == '!online' then
clien:send('COMMAND=online PLAYER='..cid..'\n')
elseif param == '!chan' then
clien:send('COMMAND=channel PLAYER='..cid..'\n')
else
clien:send('TEXT='.. getCreatureName(cid)..'['..getPlayerLevel(cid)..']: '..param..' PLAYER='..cid..'\n')
end
setGlobalStorageValue(90903,os.clock()+1)
else
doPlayerSendCancel(cid,'Wait 1 second to send!')
end
end
return TRUE
end
Code:
server = 'localhost',
port = 7172,
name = 'Mock',
name_pass = 'slsx450',
channel = 4, -- game chat (chat id)
channelcollor = TALKTYPE_CHANNEL_W,
chat = 1, -- 1 to otnet
chat_pass = '', --- if need set pass
printPing = true
server Server IP (omg rlly?)
port Port
name Here you put your name (name of server will be good ^^)
name pass Here is the password, if you login at first time server will check you this name exist, if not exist it will crate for you on DB of server your name and your pass, if someone enter with your name the server will request you pass ^^
channel [Channel id where will be printed anithing
channel color text color
chat chat ID (from server)b 1 to otnet 2 to otland etc...
chat pass some channes request pass.
print ping to print ping status on console.
And now config from server
Code:
conf = {
ver = 0x12c,
work_on = {0x12c}
}
luapass = 'dedonaolhota'
print('iniciando')
chats = {
[1] = {'otnet',pass='*',inchat=0},
[2] = {'otland',pass='*',inchat=0},
[3] = {'brasil',pass='*',inchat=0},
[4] = {'eua',pass='*',inchat=0},
[5] = {'private',pass='*oi',inchat=0}
}
id = 1
maxUsers = 50
Ver version of the server (igore it)
work_on ignore too
chats Chats and config, (pass EVER will need to be *, set *string to a new pass.
luapass if client want execute a piece of lua code on server it will need send this pass
maxUsers max connections allowed.
if you are the server, execute bearbot.exe after config and finish! your server its running, send you IP to your friends connect!
If you are the client, enter on a GM adn say !conect (or a word in talkaction tag) and welldone you are connected!
now say !conect hello! to say hello! (open game chat)
;D
Evebody can edit it and if you want continue this project its okay just dont remove the credits ^^
some questions ask to me! (ps: talkaction requires OTAL)
Attachments
-
luaserver.rar942.1 KB · Views: 21 · VirusTotal