Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) > Help with scripts

WelcomeMsg 2.0b LUA 5.1x

(1/1)

Foffa:
I've translated this script, but when I log on it don't work correctly
[10:36:47] Reg, [ctr]Marfa ввалился на хаб, от него несет бухлом и сексом.
[10:36:47] Reg, [ctr]Marfa ввалился на хаб, от него несет бухлом и сексом.                                                                                                                                                      is kicking because:
But with original phrases everything fine.

And is it posseble that evreybody could see this messages not only logged user

F_O_X:

--- Quote from: Foffa on 09 March, 2008, 08:45:20 ---[10:36:47] Reg, [ctr]Marfa ???????? ?? ???, ?? ???? ????? ?????? ? ??????.
[10:36:47] Reg, [ctr]Marfa ???????? ?? ???, ?? ???? ????? ?????? ? ??????.                                                                                                                                                      is kicking because:[/sup]

--- End quote ---

remove unnecessary


--- Code: -----[[

WelcomeMsg 2.0b LUA 5.1x [Strict] [API 1 & 2]

By Mutor 01/04/08

Provides random join/part main chat messages, per profile

-Send to Main chat or Status bar or both

+Changes from 2.0 01/14/08
+Added enable/disable receive messages, per profile
+Added a few more messages.


***Notes:
If your client does not display message in status bar
and displays the entire kick string in main,
enable 'Filter Kick and NMDC debug Messages'
in DC Settings -> Appearance

]]

-- [#] = true/false, (false = Messages Disabled, true = Messages Enabled)
local ReadProfiles  = {
[-1] = false, --Unregistered User
[0] = true, --Master
[1] = true, --Operator
[2] = false, --Vip
[3] = false, --Registered User
}
-- Botname pulled from the hub or use "CustomName"
local Bot = function() if Core then return SetMan.GetString(21) else return frmHub:GetHubBotName() end end
-- Send messages to main chat? true/false
local MainMsg = true
-- Send messages to status bar? true/false
local SbMsg = true
-- [#] = 0/1, {false = Ignore Profile, true = Check Profile,{"Join Messges"},{"Part Messages"}}
local Profiles  = {
[-1] = {false,{-- Messages enabled true/false
-- Join Messages
"Everyone welcome <prof>, <user> to the hub.",
"<prof> <user>, has arrived direct from the State Prison's work release program.",
"Wow <user>, you have some nerve showing your face in here again. :P",
},{
-- Part Messages
"See you later <user>\t....you wanker :P",
"Christ! I thought <prof> <user> would never leave.",
"Go in peace <prof> <user>",
},
},
[0] = {true,{
"????? ?? ?? ???????? <user>?",
"??, ???????, ??? ??? ??????.....??? <prof> <user>!",
"?????????? ???????????????? <prof> <user>.",
},{
"????????? ?????? <user>",
"???, ??? ??????? <prof> <user>?",
"????, <user> ????? ?? ??? ??? ????? ??????!",
},
},
[1] = {true,{
"????????? ???? ?????? <prof> <user>.",
"<prof> <user>, ????? ?? ??? ? ?????? ???? ? ?????? ????????.",
"<prof> <user> ????????? ?? ???.",
},{
"???? <user> ??? ???? ???????????? ?????????, ???? ???????!",
"????? ?????-???? ???, <user> ?????????.",
"?????? ? ?? ????, ??? <prof> <user> ??? ?????.",
},
},
[2] = {true,{
"????? ?????????? <prof>, <user>, ?? ???? ?? ????",
"?? ??????????? ?? ? ??????? <prof> <user> [?? ???????? ??? 200 ???. ?? ???]",
"????????, ?????? ??????????, <prof> <user> ?????? ?? ???.",
},{
"??? ???? ?????? <prof> <user>, ???? ???????",
"???? ? ????? <user>?",
"??????? ? ???? <user>?",
},
},
[3] = {true,{
"<prof>, <user> ???????? ?? ???, ?? ???? ????? ?????? ? ??????.",
"???, ??? ?? ????? <user>, ???? ?????? ??????.",
"??? ???? ?????? <user> ??? ? ????? ???????.",
},{
"????? ??? ?? ?????? ?? ??????? ?? ??????? <user>.",
"????????????, <prof> <user> ?????? ????? ????????????? ??? ?????????????? ????.",
"<prof> <user>, ????? ?????!",
},
}
}

UserConnected = function(user,data)
DoMsg(user,2)
end
OpConnected,RegConnected,NewUserConnected = UserConnected,UserConnected,UserConnected

UserDisconnected = function(user,data)
DoMsg(user,3)
end
RegDisconnected,OpDisconnected = UserDisconnected,UserDisconnected

DoMsg = function(user,x)
local nick = user.sName or user.sNick
local p = user.iProfile
if Profiles[p] and Profiles[p][1] then
local Msg,s = "",Profiles[p][x][math.random(#Profiles[p][x])]
s = s:gsub("\<prof\>",GetProf(p)):gsub("\<user\>",nick)
if s:len() > 0 then
if MainMsg then
Msg = s.."|"
end
--[[ if SbMsg then
Msg = Msg..s..string.rep("\t",50).."is kicking because:|"
end ]]--
if Msg:len() > 0 then
Core.SendToUser(user,Msg.."|")
Send(Msg)
end
end
end
end

GetProf = function(i)
local Prof = "Unregistered User"
if i ~= -1 then
if Core then
Prof = ProfMan.GetProfile(i).sProfileName
else
Prof = GetProfileName(i)
end
end
return Prof
end

Send = function(msg)
if Core then
for i,v in ipairs(Core.GetOnlineUsers()) do
if ReadProfiles[v.iProfile] then
Core.SendToUser(v,"<"..Bot().."> "..msg.."|")
end
end
else
for i,v in ipairs(frmHub:GetOnlineUsers()) do
if ReadProfiles[v.iProfile] then
v:SendData(Bot(),msg)
end
end
end
end
--- End code ---

Navigation

[0] Message Index

Go to full version