PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Conversion Requests => Topic started by: ]-[?LL?L?L??nG?L on 16 March, 2008, 13:48:31

Title: tag script
Post by: ]-[?LL?L?L??nG?L on 16 March, 2008, 13:48:31
Can I plz have a conversion to the new API of this little script plz  :P :P

-- Another try ;-)
---Lua 5 Description Tag by ??????Hawk?????? 07-05-2005
-- Lua 5.1 ny Madman, 16.04.06
--Commands
--
-- !dset [Nick] [Description] Sets the Description ov a Given User
-- !ddel [Nick] Sets description back to Normal. Requires user to log back in to clear.
--


HubOwner = "]-[?LL?L?L??nG?L" --// Set Your Nick Here
Mins =  1 --// Time in mins to update the Tags

tTables = {
tProfiles = {
["0"]  = {
["Enable"] = 0, --//  1 to enable tag    0 to disable
["Description"] = "owner", --// Set the Owner Tag Here Eg.   ["Description"] = "I AM THE OWNER",
},
["0"] = {
["Enable"] = 1,
["Description"] = "master", --// Set the Master Tag Here
},
["2"] = {
["Enable"] = 0,
["Description"] = "superUser", --// Set the SuperUser Tag Here
},
["1"] = {
["Enable"] = 1,
["Description"] = "op", --// Set the OP Tag Here
},
["4"] = {
["Enable"] = 0,
["Description"] = "kvip", --// Set the KVIP Tag Here
},
["2"] = {
["Enable"] = 1,
["Description"] = "vip", --// Set the VIP Tag Here
},
        ["3"] = {
["Enable"] = 1,
["Description"] = "reg", --// Set the Reg Tag Here
},



},
tUserCommands = {
["!dset"] = function(user,data)
local _,_,dUser,dDescrip = string.find( data, "%b<>%s+%S+%s+(%S+)%s+(.*)" )
if dUser and dDescrip then
tTables.tUsers[dUser] = dDescrip
user:SendData(tBot,dUser.."'s Description is now set to '"..dDescrip..".")
else
user:SendData(tBot,"ERR..  Command is.... !dset [Nick] [Description]")
end
return 1
end,


["!ddel"] = function(user,data)
local _,_,dUser = string.find( data, "%b<>%s+%S+%s+(%S+).*" )
if dUser then
tTables.tUsers[dUser] = nil
user:SendData(tBot,dUser.."'s Description is now set to Normal.")
else
user:SendData(tBot,"ERR..  Command is....  !ddel [Nick]")
end
return 1
end,
},
tUsers = {},

}

tBot = frmHub:GetHubBotName()
timer = 60000 * Mins
function Main()
SetTimer(timer)
StartTimer()
end

function OnTimer()
for tProfile,tInfo in pairs(tTables.tProfiles) do
if tTables.tProfiles[tProfile]["Enable"] == 1 then
for x,usr in pairs(frmHub:GetOnlineUsers(tProfile)) do
local userToShow = GetItemByName(usr["sName"])
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
if tTables.tUsers[userToShow.sName] then
SendToAll( "$MyINFO $ALL "..name.." "..tTables.tUsers[userToShow.sName].."$ $"..speed.."$"..email.."$"..share.."$")
else
SendToAll( "$MyINFO $ALL "..name.." "..tTables.tProfiles[tProfile]["Description"].." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
end
end

function ChatArrival(curUser, data)
data = string.sub(data,1,string.len(data)-1)
local _,_,tCmd = string.find( data, "%b<>%s+(%S+).*" )
if tCmd  and curUser.sName == HubOwner then
if tTables.tUserCommands[tCmd] then
return tTables.tUserCommands[tCmd](curUser, data)
end
end
end




Thank You in Advance  :-* :-* :-*
Title: Re: tag script
Post by: Madman on 16 March, 2008, 20:07:25

-- Another try ;-)
---Lua 5 Description Tag by ?˜”??•Hawk•??”˜? 07-05-2005
-- Lua 5.1 ny Madman, 16.04.06
-- Converted to API 2 by Madman,16.03.08
-- Fixed bug with setting nick description, now keeps user org descr

--Commands
--
-- !dset [Nick] [Description] Sets the Description ov a Given User
-- !ddel [Nick] Sets description back to Normal. Requires user to log back in to clear.
--


HubOwner = "]-[€LL?L?††L€?nG€L" --// Set Your Nick Here
Mins =  1 --// Time in mins to update the Tags

tTables = {
tProfiles = {
["0"]  = {
["Enable"] = 0, --//  1 to enable tag    0 to disable
["Description"] = "owner", --// Set the Owner Tag Here Eg.   ["Description"] = "I AM THE OWNER",
},
["0"] = {
["Enable"] = 1,
["Description"] = "master", --// Set the Master Tag Here
},
["2"] = {
["Enable"] = 0,
["Description"] = "superUser", --// Set the SuperUser Tag Here
},
["1"] = {
["Enable"] = 1,
["Description"] = "op", --// Set the OP Tag Here
},
["4"] = {
["Enable"] = 0,
["Description"] = "kvip", --// Set the KVIP Tag Here
},
["2"] = {
["Enable"] = 1,
["Description"] = "vip", --// Set the VIP Tag Here
},
["3"] = {
["Enable"] = 1,
["Description"] = "reg", --// Set the Reg Tag Here
},
},
tUserCommands = {
["dset"] = function(user,data)
local _,_,dUser,dDescrip = string.find( data, "%b<>%s+%S+%s+(%S+)%s+(.*)" )
if dUser and dDescrip then
tTables.tUsers[dUser] = dDescrip
Core.SendToUser(user,"<"..tBot.."> "..dUser.."'s Description is now set to '"..dDescrip..".")
else
Core.SendToUser(user,"<"..tBot.."> ERR..  Command is.... !dset [Nick] [Description]")
end
return true
end,
["ddel"] = function(user,data)
local _,_,dUser = string.find( data, "%b<>%s+%S+%s+(%S+).*" )
if dUser then
tTables.tUsers[dUser] = nil
Core.SendToUser(user,"<"..tBot.."> "..dUser.."'s Description is now set to Normal.")
else
Core.SendToUser(user,"<"..tBot.."> ERR..  Command is....  !ddel [Nick]")
end
return true
end,
},
tUsers = {},
}

tBot = SetMan.GetString(21)
timer = 60000 * Mins

function OnStartup()
descT = TmrMan.AddTimer(timer)
end

function OnTimer(tID)
if tID == descT then
for tProfile,tInfo in pairs(tTables.tProfiles) do
if tTables.tProfiles[tProfile]["Enable"] == 1 then
for x,usr in pairs(Core.GetOnlineUsers(tonumber(tProfile))) do
local userToShow = Core.GetUser(usr.sNick,true)
local s,e,name,desc,speed,email,share = string.find(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
if tTables.tUsers[userToShow.sNick] then
Core.SendToAll( "$MyINFO $ALL "..name.." "..tTables.tUsers[userToShow.sNick].." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
else
Core.SendToAll( "$MyINFO $ALL "..name.." "..tTables.tProfiles[tProfile]["Description"].." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
end
end
end

function ChatArrival(curUser, data)
local data = string.sub(data,1,-2)
local _,_,tCmd = string.find( data, "%b<>%s+%p(%S+).*" )
if tCmd and curUser.sNick == HubOwner then
if tTables.tUserCommands[tCmd] then
return tTables.tUserCommands[tCmd](curUser, data),true
end
end
end


That should do the trick...

And so Mutor don't have to... ;p
This script is a waste of Bandwith
Title: Re: tag script
Post by: ]-[?LL?L?L??nG?L on 17 March, 2008, 08:39:27
Ahahahahaha yep he already told me  :-* :-* :-* :-*
and thank you  :-*
Title: Re: tag script
Post by: ?[-?Genius?-]? on 05 June, 2008, 06:17:05
Hi

Its possible add Unresterid user In this script?

Tankx :)