PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: yoonohoo on 16 June, 2005, 03:53:07

Title: Help with function
Post by: yoonohoo on 16 June, 2005, 03:53:07
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


Title:
Post by: jiten on 17 June, 2005, 09:33:43
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
Title:
Post by: yoonohoo on 17 June, 2005, 11:00:24
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
Title:
Post by: jiten on 17 June, 2005, 22:28:17
Thank you for your kind words :))

Cheers