Hard on OP's
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Hard on OP's

Started by kepp, 27 October, 2003, 16:37:50

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kepp

---------------------------------------------------
-- Botname = [Police]
-- Welcome info
-- made by kepp
---------------------------------------------------


B = "[Police]"

SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

function NewUserConnected(curUser)
if curUser.bOperator then
return 1
else
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("")
curUser:SendData("")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("")
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("")
curUser:SendData("Your Profile: "..curUser.iProfile)
curUser:SendData("-1 = A normal user")
curUser:SendData("0 = Master")
curUser:SendData("1 = OP")
curUser:SendData("2 = VIP")
curUser:SendData("3 = REG")
curUser:SendData("")
curUser:SendData("")
curUser:SendData("_____________________________________________")
end
end




function OpConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("")
curUser:SendData("Your Profile: "..curUser.iProfile)
curUser:SendData("")
curUser:SendData("-1 = A normal user")
curUser:SendData("0 = Master")
curUser:SendData("1 = OP")
curUser:SendData("2 = VIP")
curUser:SendData("3 = REG")
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
SendToAll(B, "Hey "..curUser.sName.." "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(B, "..opleave.. "..curUser.sName.." ? "..Gb)
end
Guarding    

tezlo

hmm most users already know their own nick and IP
and how about using GetProfileName() instead of listing all the profiles?

kepp

hmm, yea, Im a newbie at scripting, trying to learn!

How ami suppose to add that?
Guarding    

tezlo

"Your profile: "..(GetProfileName(user.iProfile) or "Unregistered")

kepp

#4
Thank you, Im starting to learn now! :)
May i aslo ask how to se the The current share amount in GB/Tb, and same thing Minimum share!!
Thanks =)

-------------------
-- Info on connect
-- Made By Kepp
-- 03/10/30
-------------------

sBot = "[Police]"

SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

function Main()
frmHub:GetMinShare()
frmHub:GetCurrentShareAmount() 
frmHub:GetHubName()
frmHub:GetUsersCount() 
end

function NewUserConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("Welcome To: "..frmHub:GetHubName().."")
curUser:SendData("")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("")
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("")
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("")
curUser:SendData("Total online users: "..frmHub:GetUsersCount().."")
curUser:SendData("")
curUser:SendData("Minimum Share for you: "..frmHub:GetMinShare().."")
curUser:SendData("")
curUser:SendData("Total Share: "..frmHub:GetCurrentShareAmount().."")
curUser:SendData("")
curUser:SendData("_____________________________________________")
end




function OpConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
SendToAll(sBot, "Hey "..curUser.sName..", "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(sBot, opleave.." "..curUser.sName.." ? "..Gb)
end
Guarding    

tezlo

the min/total share amounts come to you in  bytes..
so youll have to keep dividing by 1024 to get kB MB GB TB
and use format("%.2f", minshare) for rounding to two decimal places

few more things..
your function Main() doesnt do anything and you forgot to END it
this way NewUserConnected() will never get called
and theres no need to check if user.bOperator.. its never true
user:SendData("") doesnt do anything either

kepp

Allright, change is made!

I have alot to learn!!

something like this?

-------------------
-- Info on connect
-- Made By Kepp
-- 03/10/30
-------------------

kb = 1024
mb = kb*kb
gb = kb*kb*kb
tb = kb*kb*kb*kb

sBot = "[Police]"

SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

gSM = frmHub:GetMinShare()/(1024)

function Main()
frmHub:GetMinShare()
frmHub:GetCurrentShareAmount() 
frmHub:GetHubName()
frmHub:GetUsersCount() 
end

function NewUserConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("Welcome To: "..frmHub:GetHubName().."")
curUser:SendData("")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("")
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("")
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("")
curUser:SendData("Total online users: "..frmHub:GetUsersCount().."")
curUser:SendData("")
curUser:SendData("Minimum Share for you: "..gSM.."")
curUser:SendData("")
curUser:SendData("Total Share: "..frmHub:GetCurrentShareAmount().."")
curUser:SendData("")
curUser:SendData("_____________________________________________")
end




function OpConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("")
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("")
curUser:SendData("Your IP: "..curUser.sIP)
SendToAll(sBot, "Hey "..curUser.sName..", "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(sBot, opleave.." "..curUser.sName.." ? "..Gb)
end

Can you try to explain with maybe a few lines of codes how to do.... to set the Current share amount to TB?
Guarding    

plop

kepp as you wanne learn i'm just gone give you a hint.
check this line from your script.
gSM = frmHub:GetMinShare()/(1024)

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

hmm, he he, this topic shouln't be in finished !! :)
Hey plop, i did try to do the same thing with

frmHub:GetCurentShareAmount()/(1024)

But the result was just a bunch of numbers!
:S
Guarding    

pHaTTy

QuoteOriginally posted by kepp
hmm, yea, Im a newbie at scripting, trying to learn!

How ami suppose to add that?

hmmm if ur a newbie its not bad, pretty good for newbie :o)
Resistance is futile!

pHaTTy

why

curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))

???

curUser:SendData("Your Profile: "..curUser.iProfile)

l8rr,,
Resistance is futile!

tezlo

i thought it was clear.. and would make more sense to show the name of the profile instead of numbers that dont really say much to the user
..

pHaTTy

ooops yep sorry ;)

so you cud do

index= user.iProfile
msg = Bot,"Your profile is : "..GetProfileName(index)
user:SendData(Bot,msg)

does just the same hehehe

hehe l8rr,,
Resistance is futile!

tezlo

#13
sure.. but what you just wrote
1. will choke on unregged users and throw a concat error (GetProfileName returns nil)
2. takes one local variable and two lines of code more than it has to

plop

QuoteOriginally posted by kepp
hmm, he he, this topic shouln't be in finished !! :)
Hey plop, i did try to do the same thing with
frmHub:GetCurentShareAmount()/(1024)
But the result was just a bunch of numbers!
:S
it comes in bytes 2.
you gotta take it a couple steps further.
share/1024 = KB
share/1024/1024 = MB
etc.

you whill end up with a lot of number behind the . that can be solved with this.
share = format("%0.2f", share)
as a result you'll get max 2 numbers behind the .
i didn't use frmHub:GetCurrentShareAmount() in this example on purpose, if you now look closely you can see that you can make 1 line out of it 2 get the share in TB's.
good luck your doing great so far.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

#15
-------------------
-- Info on connect
-- Made By Kepp
-- 03/10/30
-------------------

kb = 1024
mb = 1024/1024
sgb = 1024/1024/1024
tb = 1024/1024/1024/1024

sBot = "[Police]"

SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

gSM = frmHub:GetMinShare()/(1024)
woo = format("%0.2f", frmHub:GetCurrentShareAmount()/1024/1024/1024/1024)

function Main()
frmHub:GetMinShare()
frmHub:GetCurrentShareAmount()
frmHub:GetHubName()
frmHub:GetUsersCount() 
end

function NewUserConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("Welcome To: "..frmHub:GetHubName().."")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("Total online users: "..frmHub:GetUsersCount().."")
curUser:SendData("Minimum Share for you: "..gSM.." GB")
curUser:SendData("Total Share: "..woo.." TB")
curUser:SendData("_____________________________________________")
end

function OpConnected(curUser)
curUser:SendData("_____________________________________________")

curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile)")
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("_____________________________________________")
SendToAll(sBot, "Hey "..curUser.sName..", "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(sBot, opleave.." "..curUser.sName.." ? "..Gb)
end

hmm, spent 3-4 hours figuring this out:

woo = format("%0.2f", frmHub:GetCurrentShareAmount()/1024/1024/1024/1024)

Thanks alot.... :)
This is fun, Anything else? he he
Guarding    

plop

good job just you got it in GB now.
how about making the bot pick what 2 use.
if the total share is below 1 TB making it shows in GB.
your gone need this for it.
strlen(share) ?? ?
the ?? should be replaced by something wich compairs.
the ? by a number.

look back 2 what tezlo sayd.
you can remove some part because it doesn't do anything.
and a operator is always registered, so this line can be done faster.
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))

good luck
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

Removed lines i didn't need!
i have no idea how to do that! i've read The LUA manual,
i don't get it  ?(
Guarding    

plop

this part.
function Main()
   frmHub:GetMinShare()
   frmHub:GetCurrentShareAmount()
   frmHub:GetHubName()
   frmHub:GetUsersCount() 
end
it doesn't do anything.
you get some vallue's from the hub on startup but you don't do anything with it.
you can remove it completly.
take a look @ this book.
i find it much more helpfull then the reference manual.
with that book you must be able 2 find out how 2 make the bot choose between GB and TB.
i'll give 1 more hint.
calculate the total share in GB and check how much numbers you get.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

Found strlen(s) in both manuals.
but i have no idea what to do, Anyway,
removed those lines,

doh, ofcorse i don't need them :)
I call them from curUser:SendData()
but, i can allways add RegBot() :)

-------------------
-- Info on connect
-- Made By Kepp
-- 03/10/30
-------------------

kb = 1024
mb = 1024/1024
Sgb = 1024/1024/1024
tb = 1024/1024/1024/1024

sBot = "[Police]"

SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

gSM = frmHub:GetMinShare()/(1024)
woo = format("%0.2f", frmHub:GetCurrentShareAmount()/1024/1024/1024/1024)

function Main()
frmHub:RegBot(sBot)
end

function NewUserConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("Welcome To: "..frmHub:GetHubName().."")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("Total online users: "..frmHub:GetUsersCount().."")
curUser:SendData("Minimum Share for you: "..gSM.." GB")
curUser:SendData("Total Share: "..woo.." TB")
curUser:SendData("_____________________________________________")
end

function OpConnected(curUser)
curUser:SendData("_____________________________________________")

curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("_____________________________________________")
SendToAll(sBot, "Hey "..curUser.sName..", "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(sBot, opleave.." "..curUser.sName.." ? "..Gb)
end
Guarding    

OpiumVolage

Nice to see brains in action.
I can see this for a "make your own bot" n? 5 ;)

plop

QuoteOriginally posted by OpiumVolage
Nice to see brains in action.
I can see this for a "make your own bot" n? 5 ;)
why don't you move it there or make a ghost there.

kepp i'll explain some more.
take for example 789.35 GB total share.
when you do strlen(789.35) it's gone return the vallue 6, it checks how many characters a string/vallue has.
if the total share = 22278.46 GB it's gone return 8, in this case you can devide it again by 1024 to get the share in TB.
21.76 TB looks a lot better.

in words the code you need 2 write looks as the folowing.
1 calculate the share in GB.
2 check if the vallue is 6 characters or shorter.
3 send the data to the user in GB if 2 is true.
4 if the vallue is longer (2 if false) you need to devide by 1024 again and send that vallue to the user, showing this time it's TB.
5 buy yourself a beer, you done it.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

#22
hmm, ok, So far i got this

tRL = strlen(22276.46)

That will give me the nr 8, nothing else

If i divide it with /1024

tRL = strlen(22276.46)/1024   <--- Returned 8
with one decimal

like this : 0.0078125

Which is false...
Guarding    

kepp

another thing i tried...

tRL = format("%0.2f", strlen(900.54))

ended up '6.00'

confused..
Guarding    

kepp

BETA!!! :D

-------------------
-- Info on connect
-- Made By Kepp
-- 03/10/30
-- Added: Botdecsription, such as speed, e-mail, connection
-- Idea from Mr420's botdesc script 01/11/03
-- Added: HubInfoAdvert, in main every hour
-------------------
hubadress = "your-hub.adress.here" --// :D

kb = 1024
mb = 1024/1024
Sgb = 1024/1024/1024
tb = 1024/1024/1024/1024

sEC = 1000
MiN = 60*sEC  ---// Don't touch any of this :P
Hour = 60*MiN  
---------------
sU = "[SU]xxx"
sU1 = "[SU]xxx1"      --//Your Super Operators name/s
sU2 = "[SU]xxx2"
sU3 = "[SU]xxx3"
---------------
sBot = "[Police]"    --//Botname
eBot = "[E-mail]"    --//The bots E-mail
BotS = "Faster Than Light"  --//The bots speed :D
Botdesc = "El Jefe"         --//Botdescription! El Jefe = The boss
botTag = "<--)V:0.999>"
---------------
SirYesSir = "Now Get Back To Work!"
opleave = "Where do you think you are going"
Gb = "Get Back Now!"

gSM = frmHub:GetMinShare()/(1024)
woo = format("%0.2f", frmHub:GetCurrentShareAmount()/1024/1024/1024/1024)

function Main()
SetTimer(Hour)
StartTimer()
frmHub:RegBot(sBot)
mIS = "$MyINFO $ALL "..sBot.." "..Botdesc.."$ $"..botTag.."$ $"..BotS..strchar( 1 ).."$"..eBot.."$"
SendToAll( mIS )
end

function NewUserConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("Welcome To: "..frmHub:GetHubName().."")
curUser:SendData("Your Name: "..curUser.sName)
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("Your Version: "..curUser.iVersion)
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("Total online users: "..frmHub:GetUsersCount().."")
curUser:SendData("Minimum Share for you: "..gSM.." GB")
curUser:SendData("Curent Share Amount: "..woo.." TB")
curUser:SendData("_____________________________________________")
end

function OpConnected(curUser)
curUser:SendData("_____________________________________________")
curUser:SendData("Your Profile: "..(GetProfileName(curUser.iProfile) or "Unregistered"))
curUser:SendData("Your IP: "..curUser.sIP)
curUser:SendData("_____________________________________________")
SendToAll(sBot, "Hey "..curUser.sName..", "..SirYesSir)
end

function OpDisconnected(curUser)
SendToAll(sBot, opleave.." "..curUser.sName.." ? "..Gb)
end

function OnTimer()
SendToAll("Hub Name:")
SendToAll("\t\t\t\t\t["..frmHub:GetHubName().."]")
SendToAll("_____________________________________________")
SendToAll("Super Operators:")
SendToAll("["..sU.."]")
SendToAll("["..sU1.."]")
SendToAll("["..sU2.."]")
SendToAll("["..sU3.."]")
SendToAll("\t __________________________________________________________________")
SendToAll("\t\t Write /fav in main chat, And BOOM, our hub is in your Favorites")
SendToAll("\t __________________________________________________________________")
SendToAll("(`?._.?-=@ Remember : Enjoy your stay and let the DC sprit rule @=-?._.??)")
SendToAll("\t\t\t // Crew @ "..hubadress.."")
end
Guarding    

SMF spam blocked by CleanTalk