PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Riouel on 13 December, 2003, 05:35:58

Title: i need a small script
Post by: Riouel on 13 December, 2003, 05:35:58
hi all

i need a script that pop up a new page for rules

this way all poeple who log will see it

thanx in advance

Riouel  8)
Title:
Post by: pHaTTy on 13 December, 2003, 05:51:16
Hi there,,


--mini onconect rules on request
--by phatty
--make a file in the scripts directory called rules.txt for your rules

Bot = "Wolf"
RulesFile = "rules.txt"


function NewUserConnect(user)
readfrom(RulesFile)
while 1 do
line = read("*a")
if line == nil then
break
end
user:SendData(Bot,line)
readfrom()
end
end


l8rr,,

-phatty
Title:
Post by: turkiye on 13 December, 2003, 09:17:59
It works NOT!!
Title:
Post by: BlazeXxX on 16 December, 2003, 13:10:52
- Start Copying from here
- Scripted by BlazeX
- Requested By Riouel

Bot = "RulesBOT"
function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(curUser)
readfrom("rules.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end
- Finish copying at this line

You need to have a text file called rules.txt in your scripts directory.. once u done that, restart ur scripts..

REMEBER: IT won't show the rules, if u are logged in as op ! so login as user, u will see it!

Cya!
Title:
Post by: c h i l l a on 16 December, 2003, 13:23:13
just...  one thing I don't think its so great to have the hub read from disk everytime a user connects so I would do it like this actually

File = "File.txt"

function Main()
rules = function ReadFile()
end

function NewUserConnected(curUser)
curUser:SendData(rules)
end

function ReadFile()
local handle = openfile("txt/"..File, "r")
if handle then
local contents = gsub(read(handle, "*a"),strchar(10), "\r\n")
closefile (handle)
return contents
end
end
Title:
Post by: BlazeXxX on 16 December, 2003, 13:38:11
1 + 4 = 5
2 + 3 = 5

Does the same job, hehe.. kidding ;) will try that one and see how effective it is :D
Title: NICE JOB
Post by: Riouel on 23 December, 2003, 04:05:18
THANX BlazeXxX  ;)

I WORK LIKE I WANT

I REALLY APRECIATE IT

Riouel  :D
Title:
Post by: pHaTTy on 23 December, 2003, 15:01:20
QuoteOriginally posted by (uk-kingdom)pH?tt?
Hi there,,


--mini onconect rules on request
--by phatty
--make a file in the scripts directory called rules.txt for your rules

Bot = "Wolf"
RulesFile = "rules.txt"


function NewUserConnect(user)
readfrom(RulesFile)
while 1 do
line = read("*a")
if line == nil then
break
end
user:SendData(Bot,line)
readfrom()
end
end


l8rr,,

-phatty

oops sorry i made one tiny little mistake, my head was spinning that night lol



--mini onconect rules on request
--by phatty
--make a file in the scripts directory called rules.txt for your rules

Bot = "Wolf"
RulesFile = "rules.txt"


function NewUserConnected(user)
readfrom(RulesFile)
while 1 do
line = read("*a")
if line == nil then
break
end
user:SendData(Bot,line)
readfrom()
end
end



so it does work :P