Help with function
 

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

Help with function

Started by yoonohoo, 16 June, 2005, 03:53:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yoonohoo

I need to stop this cmd appearing in all users. What must be changed?
Thanks

function Guarding:GenerateUserMenu(Profile)

	local sMsg = "$UserCommand 1 7 ||";

	local tmp = "";

	for i,v in CmdLvls do

		if (v[Profile] ~= 0) then

			tmp = string.gsub(v.UserCommand, "%[PREFIX]",Settings.Prefix);

			sMsg = sMsg..tmp;

		end

	end

	-- Files

	local FileCmd = "$UserCommand 1 3 Guarding\\Text files\\Show [FILE]$<%[mynick]> [PREFIX][FILE]||"

	for i,v in tTextfiles do

		tmp = "";

		local s,e,FileName = string.find(i,"(%S+)%.%S+");

		if (FILES[FileName]) then

			if (FILES[FileName][Profile] == 1) then

				tmp = string.gsub(FileCmd,"%[PREFIX]",Settings.Prefix);

				tmp = string.gsub(tmp,"%[FILE]",FileName);

				sMsg = sMsg..tmp;

			end

		end

	end

	return sMsg;

end

It might be simple for you but rocket science for me...

jiten

In this function change to the red line:
function ChatArrival(user,sData)
	sData = string.sub(sData,1,-2);
	local s,e,sCmd = string.find(sData,"^%b<>%s+(%S+)");
	if (sCmd) then
		local sPrefix = string.sub(sCmd,1,1);
		if (Settings.Prefix == sPrefix) then
			sCmd = string.sub(sCmd,2,-1);
			if (Commands[sCmd]) then
				return Commands[sCmd](user,sData);
			elseif (Guarding:FileExists(sFolder3..sCmd..".txt") == 1) then
				if (FILES[sCmd][user.iProfile] == 1) then
					sMsg = Guarding:LoadTextFile(sFolder3..sCmd..".txt");
					[COLOR=red]return user:SendPM(sBot,sMsg),1[/COLOR];
				end
			end
		end
	end
Best regards

yoonohoo

If ever there's a poll in this forum for the best and most helpfull scripter you'll get my vote.
Thinking of changing my sig to: Thanks jiten!  :D
By the way thanks m8

It might be simple for you but rocket science for me...

jiten

Thank you for your kind words :))

Cheers

SMF spam blocked by CleanTalk