PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 13 December, 2003, 01:19:22

Title: Lancer Hider By Phatty
Post by: pHaTTy on 13 December, 2003, 01:19:22
well i got sick of the nick taken error so decided to start on a proper one ;)


--Lance Evol v1.00
--Hider Bot, this one does not give the nick taken error ;)
--Written by Phatty 12th December 2k3
--Need to sort the Logged in LogedIn not work neither any ideas?

Bot = "?????R"
Hidden = {}

function NewUserConnected(user)
if Hidden == nil then
return 1
else
for i,v in Hidden do
user:SendData( "$Quit "..i )
end
end
end

function OpConnected(user)
if Hidden == nil then
return 1
else
for i,v in Hidden do
user:SendData( "$Quit "..i )
end
end
end

function DataArrival(user, data)
if(strsub(data, 1, 4) == "$Quit ") then
if Hidden[user.sName] == 1 then
Hidden[user.sName] = nil
end
end

if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if cmd == "hide" then
if user.bOperator then
SendToAll( "$Quit "..user.sName )
Hidden[user.sName] = 1
end
elseif cmd == "unhide" then
if user.bOperator then
SendToAll( "$LoggedIn "..user.sName )
Hidden[user.sName] = nil
end
end
end
end


i need to sort a few things when i get time.....but it works......:))

-phatty
Title:
Post by: tezlo on 13 December, 2003, 01:29:13
$Hello
Title:
Post by: pHaTTy on 13 December, 2003, 01:34:00
QuoteOriginally posted by tezlo
$Hello

Dam yep thats it Thanx dude :)))
Title:
Post by: pHaTTy on 13 December, 2003, 01:34:49
change


            SendToAll( "$LoggedIn "..user.sName )

to


            SendToAll( "$Hello "..user.sName )


thanx agen tezlo :)
Title:
Post by: kepp on 16 December, 2003, 18:38:42
Thank you :)
Title:
Post by: BlazeXxX on 17 December, 2003, 17:57:00
Nice one dude ;-) Hope to see more useful script from you  :D
Title:
Post by: xokas on 17 December, 2003, 18:02:22
this script is for?it does the same as nicktakenbot?and no offense phatty but works good?
Title:
Post by: jiten on 29 September, 2004, 21:17:32
hi there Phatty.

just wanted to ask you something about this hider.
i've tried this one and nErBos'.
the problem is that both of them have bugs.

This one doesn't give the nick taken error, but, when i hide myself from the userlist, i always reappear after some minutes, and can't stay "invisible" for more than that time..

On the other hand, the one made by nErBoS gives the nick taken error, when i try to reconnect, even after doing the !unhide command. so, i always have to restart the hub, to reconnect again.

can you fix this in your hider?
thanks.

jiten
Title:
Post by: nErBoS on 30 September, 2004, 00:12:13
Hi,

Little Update...

--Lance Evol v1.01
--Hider Bot, this one does not give the nick taken error ;)
--Written by Phatty 12th December 2k3
--little update today ehmm today issss 14th april 2k4
--Update on Saving Table by nErBoS
--User still hide by refresh list by nErBoS

Bot = "?bot?" ;
Hidden = {}
fHidden = "hidden.dat"

--## Configuration ##--

uLaterPtokax = 0 -- Choose 0 if your Ptokax Version is 0.3.3.0 or higher
-- Choose 1 if your Ptokax Version is lower then 0.3.3.0

--## END ##--

function Main()
frmHub:EnableFullData(1)
LoadFromFile(fHidden)
end

function OnExit()
SaveToFile(fHidden , Hidden , "Hidden")
end

function NewUserConnected(user)
if (Hidden[user.sName] ~= nil) then
SendToAll("$Quit "..user.sName)
end
if Hidden ~= nil then
for i,v in Hidden do
user:SendData("$Quit "..i)
end
end
return 1
end

OpConnected = NewUserConnected

function DataArrival(user, data)
if(strsub(data, 1, 5) == "$Quit") then
if Hidden[user.sName] == 1 then
Hidden[user.sName] = nil
if (uLaterPtokax == 1) then
OnExit()
end
end
elseif strsub(data, 1, 1) == "<" then
local data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "!hide" and user.bOperator then
SendToAll( "$Quit "..user.sName )
Hidden[user.sName] = 1
if (uLaterPtokax == 1) then
OnExit()
end
return 1
elseif cmd == "!unhide" and user.bOperator then
SendToAll( "$Hello "..user.sName )
Hidden[user.sName] = nil
if (uLaterPtokax == 1) then
OnExit()
end
return 1
end
elseif strsub(data, 1, 8) == "$GetINFO" then
local s,e,who = strfind(data, "%$GetINFO%s+(%S+)")
if (Hidden[who] ~= nil) then
user:SendData("$Quit "..who )
return 1
end
end
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end

The Connect still miss, if anyone have any ideia please post it.

Best regards, nErBoS
Title:
Post by: [NL]Pur on 30 September, 2004, 16:09:50
btw it's logedin
not loggedin

and yes the one who designed te protocol wasn't good in english.