PtokaX forum

Development Section => Your Developing Problems => Topic started by: Woodster on 09 March, 2004, 23:52:49

Title: My Bot
Post by: Woodster on 09 March, 2004, 23:52:49
--//Welcome Bot - Used from LUA FORUMS - Adapted and modifed by Woody for -=MSI=- by Woody
sBotName = "Bot_Name"

frmHub:RegBot(sBotName)

function GetOnline(pro)
local user,t = GetUsersByProfile(pro),0
for index,val in user do
if GetItemByName(user) then
t = t + 1
end
end
return t
end

function OpConnected(user)
local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: ....\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules. Please Read and Abide by them! \r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..GetOnline("Master").."\r\n"
tmp = tmp.."\t??? Operators Online: "..GetOnline("Operator").."\r\n"
tmp = tmp.."\t??? VIPs Online: "..GetOnline("VIP").."\r\n"
tmp = tmp.."\t??? REGs Online: "..GetOnline("Reg").."\r\n"
tmp = tmp.."\ \r\n"

user:SendPM(sBotName,tmp)
end


--function NewUserConnected(user)
-- local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
-- usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

function NewUserConnected(user)
i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)$")
-- this if routine is checking so if the share cannot be extracted , shre equals to zero. and
-- prevents nil / 1024 * 1024 * 1024 (which are causing the error)
if share == nil then
share = 0
end
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: ....\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules. Please Read and Abide by them! \r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Users Online: "..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..GetOnline("Master").."\r\n"
tmp = tmp.."\t??? Operators Online: "..GetOnline("Operator").."\r\n"
tmp = tmp.."\t??? VIPs Online: "..GetOnline("VIP").."\r\n"
tmp = tmp.."\t??? REGs Online: "..GetOnline("Reg").."\r\n"
tmp = tmp.."\ \r\n"


user:SendPM(sBotName,tmp)
end


Recently started to make my own bot...

Still fairly new to LUA but....

as it is would this script be suitable to add into my bot, or would edits need to be made?

Thanx

Woody
Title:
Post by: pHaTTy on 10 March, 2004, 00:00:16
well dont forget the functions must mix if they deicated functions, what i mean is

function DataArrival(whatever,youhave)
end

function NewUserConnected(whatever)
end

function OpConnected(whatever)
end

function Main()
end


these functions must combine

hope u understand if u can post ur script, and ill be happy to help ;)
Title:
Post by: Woodster on 10 March, 2004, 00:05:56
My Script is too long to post on here

:(

Woody
Title:
Post by: pHaTTy on 10 March, 2004, 00:07:50
QuoteOriginally posted by Woodster
My Script is too long to post on here

:(

Woody


post you OpConnected function and new user connect function

EDIT: and your globals such as botname = balh

just so i know what global name u have used
Title:
Post by: Woodster on 10 March, 2004, 00:14:13
function OpConnected(curUser)

if (isSuperOp(curUser.sName) == "TRUE") then
SendToAll(Bot, "The Super Operator -->>"..curUser.sName.."<<--  has entered the hub, Hello "..curUser.sName.."!")
else
SendToAll(Bot, "The Operator -->> "..curUser.sName.." <--  has entered the hub, Hello "..curUser.sName.."!")
end
end

You mean that?
Title:
Post by: pHaTTy on 10 March, 2004, 00:29:19
QuoteOriginally posted by Woodster
function OpConnected(curUser)

if (isSuperOp(curUser.sName) == "TRUE") then
SendToAll(Bot, "The Super Operator -->>"..curUser.sName.."<<--  has entered the hub, Hello "..curUser.sName.."!")
else
SendToAll(Bot, "The Operator -->> "..curUser.sName.." <--  has entered the hub, Hello "..curUser.sName.."!")
end
end

You mean that?

well yup, for example, ill combine the oc for you

function OpConnected(user)
local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))
local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: ....\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules. Please Read and Abide by them! \r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..GetOnline("Master").."\r\n"
tmp = tmp.."\t??? Operators Online: "..GetOnline("Operator").."\r\n"
tmp = tmp.."\t??? VIPs Online: "..GetOnline("VIP").."\r\n"
tmp = tmp.."\t??? REGs Online: "..GetOnline("Reg").."\r\n"
tmp = tmp.."\ \r\n"
user:SendPM(Bot,tmp)
if (isSuperOp(curUser.sName) == "TRUE") then
SendToAll(Bot, "The Super Operator -->>"..curUser.sName.."<<--  has entered the hub, Hello "..curUser.sName.."!")
else
SendToAll(Bot, "The Operator -->> "..curUser.sName.." <--  has entered the hub, Hello "..curUser.sName.."!")
end
end

give other a shot and pst it here if doesnt work and ill correct it ;)
Title:
Post by: Woodster on 10 March, 2004, 00:33:57
**** **** **** ****

Just deleted my BOT  X(  X(  X(

 ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(

Oh Well guess it wasnt ment to be!

Either i will start again....... or scan the forums for a basic bot that i can adapt and make better

 ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(

Thanx anyway for your help phatty - much appreciated

Woody
Title:
Post by: pHaTTy on 10 March, 2004, 00:36:15
QuoteOriginally posted by Woodster
**** **** **** ****

Just deleted my BOT  X(  X(  X(

 ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(

Oh Well guess it wasnt ment to be!

Either i will start again....... or scan the forums for a basic bot that i can adapt and make better

 ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(  ;(

Thanx anyway for your help phatty - much appreciated

Woody

whaaat? lol

hmmm, well i can make you a base start if u like, depends on what you want in it, also u can take younger gekko versions mess with them if u like, til u get the basic idea,

later,,