PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: HaL on 23 February, 2004, 17:35:37

Title: nick exchange script
Post by: HaL on 23 February, 2004, 17:35:37
hey @all

i have a idea 4 a script
but i can?t write it alone

the idea is
if user "ted" write in mainchat
hello
it looks like

hello

and now the script takes a random-name  from the
users.dat maybe there is a user called "al"
the script makes it

hello

the script also exchanges the nicks in mainchat

additionally not only the nicks from users.dat
so some nicks from script

so nobody knows what nick comes next

i called it nickparty
i prefer the comands !npon
and !npoff
so i can turn on and off the nickparty

 

names = {
"Eddi",
"Fish",
"Faker",
"Leecher"
}          

thats what i have but i really can?t write it alone for now
because im not good enought in lua

if party > 0 then
         s,e,mes = strfind(data, "%b<> (.*)")
            if mes == nil then
            else



      name=names[random(1, getn(names))]
                  SendToAll(name, mes)
               return 1
               end


 is there one who will write this script?

HaL
Title:
Post by: nErBoS on 23 February, 2004, 18:17:56
Hi,

If i understood you want a script which changes the nick of a user when is talking, eg:

user writes hello it should appear this..

hello

but the script will make this ...

hello

and you want commands to turn on and off this ??
This command it should only be use by Operatores, right ??

Best regards, nErBoS
Title:
Post by: HaL on 23 February, 2004, 19:00:08
yes thats it

but the script should not only change the nicks with the nicks of the names table
there is a useres.dat in ptokax in this are all names of all registered users

the script also changes nicks with registered users and nicks from the table

thx 4 your reply nErBoS
Title:
Post by: nErBoS on 23 February, 2004, 20:52:28
Hi,

You are talking about RegisteredUser.dat it think is not a good ideia to work on that file.
Title:
Post by: HaL on 23 February, 2004, 21:22:19
ok can you tell me why do you think so?

its no problem for me to add the reg users to the names table , so you can forget the regusers.dat

:-)

HaL
Title:
Post by: nErBoS on 23 February, 2004, 21:42:28
Hi,

The script that i'm think on doing is no need to use the registereduser.dat the script will work to all connected users, execpt ops.

Best regards, nErBoS
Title:
Post by: nErBoS on 24 February, 2004, 01:46:40
Hi,

Hope it helps.....

--Requested by HaL
--Made by nErBoS

Bot = "Playing-Bot"

names = {
"Eddi",
"Fish",
"Faker",
"Leecher"
}

affect = {
"nErBoS"
} --Users that will be affected

play = "off" --Every time you restart script or hub the option play will be off


function Main()
frmHub:RegBot(Bot)
end


function DataArrival(user, data)
if (play == "on") then
for i=1, getn(affect) do
if strfind(data, affect[i]) then
s,e,msg = strfind(data,"%b<>%s+(.*)")
name=names[random(1, getn(names))]
SendToAll(name, msg)
return 1
end
end
end

if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!play") then
s,e,opt = strfind(data,"%b<>%s+%S+%s+(%S+)")
if (opt == "on" or opt == "off") then
play = opt
user:SendPM(Bot, "The play has been put "..opt)
return 1
else
user:SendPM(Bot, "Syntax error, !play . ")
return 1
end
end
end
end

Best regards, nErBoS
Title:
Post by: HaL on 24 February, 2004, 08:55:55
thx nerbos the script works

but could you do some little changes?

the script does for now only change nicks that listet in affected nicks better is that every connected users nick would be changed

if the connected users nicks will be changed with nicks from connected users too would be perfect ;-)

turn on and off the script is allowed for every user better will be only for ops.

great job nErBoS
Title:
Post by: nErBoS on 24 February, 2004, 15:10:17
Hi,

Done..

--Requested by HaL
--Made by nErBoS

Bot = "Playing-Bot"

names = {
"Eddi",
"Fish",
"Faker",
"Leecher"
}

affect = {
"nErBoS"
} --Users that will be affected

play = "off" --Every time you restart script or hub the option play will be off


function Main()
frmHub:RegBot(Bot)
end


function DataArrival(user, data)
if (play == "on") then
for i=1, getn(affect) do
if strfind(data, affect[i]) or (not user.bOperator and strfind(data, user.sName)) then
s,e,msg = strfind(data,"%b<>%s+(.*)")
name=names[random(1, getn(names))]
SendToAll(name, msg)
return 1
end
end

end

if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!play") then
if (user.bOperator) then
s,e,opt = strfind(data,"%b<>%s+%S+%s+(%S+)")
if (opt == "on" or opt == "off") then
play = opt
user:SendPM(Bot, "The play has been put "..opt)
return 1
else
user:SendPM(Bot, "Syntax error, !play . ")
return 1
end
else
user:SendPM(Bot, "You don't have permission to use this command.")
return 1
end
end
end
end

Best regards, nErBoS
Title:
Post by: HaL on 24 February, 2004, 17:20:23
thx nErBoS

that script  was funny

great work :-)
Title:
Post by: HaL on 24 February, 2004, 19:26:37
i have one problem with the script :-)

i can?t stop it *lol

could some one fix it?

thx HaL
Title:
Post by: HaL on 24 February, 2004, 19:37:16
now i see i need a nick that was not affected
that could stop the nickparty :-)

:-)
Title:
Post by: nErBoS on 24 February, 2004, 20:10:43
Hi,

Any op can stop the script, if the op nick isn?t in the affect list of course, if you have all ops in the affected list the only way to stop it is to restart the script :)

Best regards, nErBoS
Title:
Post by: HaL on 24 February, 2004, 23:18:45
hi nErBoS

but the only way to restart the script ist to restart the hub
and the !restartscripts + !restart cmd does not work too

HaL
Title:
Post by: nErBoS on 25 February, 2004, 01:07:38
Hi,

The restartscript should do because i put the play = "off" to start off, instead of using a command try to do manualy. But don?t you have a op that isn?t affect with command to shut down ?? It?s hard that way to urn off the command.

Best regards, nErBoS