PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Snooze on 17 March, 2004, 20:36:51

Title: [Request] Special description for Master, Op, VIP, Reg
Post by: Snooze on 17 March, 2004, 20:36:51
After finding this script :

--Requested by angelsanges
--Made by nErBoS

Bot = "Hide-Share"

hiders = {
"nErBoS",
"angelsanges"
} --- just put here the nick of the person that you want to hide

function Main()
frmHub:RegBot(Bot)
end

OpConnected = NewUserConnected

function NewUserConnected(user, data)
HideShare()
end


function DataArrival(user, data)
SendToAll(data)
HideShare()
end

function HideShare()
for i=1,getn(hiders) do
if(GetItemByName(hiders[i]) == nil) then
else
local userToBeHide = GetItemByName(hiders[i])
if (userToBeHide.sMyInfoString ~= nil) then
local s,e,desc,speed,email,share = strfind(userToBeHide.sMyInfoString, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..desc.."$ $"..speed.."$"..email.."$0$")
else
end
end
end
end

..I got the idea to put a (Master) infront of the users description (if the user was a master)

Though after entens work i've failed to make it work.

SO.... Once again i ask for your help :)


**Snooze
Title:
Post by: nErBoS on 17 March, 2004, 23:52:25
Hi,

His this what you want ??...

--Requested by angelsanges
--Made by nErBoS

Bot = "Hide-Share"

hiders = {
"nErBoS",
"angelsanges"
} --- just put here the nick of the person that you want to hide

function Main()
frmHub:RegBot(Bot)
end

OpConnected = NewUserConnected

function NewUserConnected(user, data)
HideShare()
end


function DataArrival(user, data)
SendToAll(data)
HideShare()
end

function HideShare()
for i=1,getn(hiders) do
if(GetItemByName(hiders[i]) == nil) then
else
local userToBeHide = GetItemByName(hiders[i])
if (userToBeHide.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = strfind(userToBeHide.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
if (userToBeHide.Profile == 0) then
SendToAll( "$MyINFO $ALL "..name.." [Master] "..desc.."$ $"..speed.."$"..email.."$0$")
else
SendToAll( "$MyINFO $ALL "..name..desc.."$ $"..speed.."$"..email.."$0$")
end
else
end
end
end
end

Best regards, nErBoS
Title:
Post by: Snooze on 18 March, 2004, 01:54:15
Thanks for the reply nErBoS.

Both yes and no.

This should work for ANY master entering the hub and other than adding the [Master] to his/her description it shouldnt change anything.

I hope that explains it better.



**Snooze
Title:
Post by: nErBoS on 18 March, 2004, 02:26:45
Hi,

You are right bad reading by me :P

--Requested by Snooze
--Made by nErBoS

Bot = "Masters-Desc"

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
MasterDesc()
end

OpConnected = NewUserConnected

function DataArrival(user, data)
MasterDesc()
end

function MasterDesc()
local aux,usr
for aux, usr in GetUsersByProfile("Master") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToBeHide.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = strfind(userToBeHide.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." [Master] "..desc.."$ $"..speed.."$"..email.."$0$")
end
end
end
end

Best regards, nErBoS
Title:
Post by: Snooze on 18 March, 2004, 03:17:00
Thanks :))

Once again you save me lol


**Snooze
Title:
Post by: Snooze on 18 March, 2004, 05:14:52
I found a small bug.

The MasterDesc() function should look like this:


function MasterDesc()
local aux,usr
for aux, usr in GetUsersByProfile("Master") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." [Master] "..desc.."$ $"..speed.."$"..email.."$0$")
end
end
end
end

You had two "userToBeHide" from the old script ;)

Other than that it worked perfect - Thanks !!

I noticed that im getting an error:

Syntax Error: attempt to concat local `email' (a nil value)

Can i assume that its from users not having any email in their description ?

**Snooze
Title:
Post by: nErBoS on 18 March, 2004, 12:44:47
Hi,

Yep Snooze you are right on every think :)

This will sove that nil...

function MasterDesc()
local aux,usr
for aux, usr in GetUsersByProfile("Master") do
if (GetItemByName(usr) ~= nil) then
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
if (email == nil) then
email = ""
end
SendToAll( "$MyINFO $ALL "..name.." [Master] "..desc.."$ $"..speed.."$"..email.."$0$")
end
end
end
end

Best regards, nErBoS
Title:
Post by: Snooze on 20 March, 2004, 03:27:16
Thanks m8 :))



**Snooze