[Request] Special description for Master, Op, VIP, Reg
 

[Request] Special description for Master, Op, VIP, Reg

Started by Snooze, 17 March, 2004, 20:36:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snooze

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

nErBoS

#1
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
--## nErBoS Spot ##--

Snooze

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

nErBoS

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
--## nErBoS Spot ##--


Snooze

#5
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

nErBoS

#6
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
--## nErBoS Spot ##--


SMF spam blocked by CleanTalk