PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: FoX on 17 October, 2013, 12:08:09

Title: Right mouse commands
Post by: FoX on 17 October, 2013, 12:08:09
Hi all  ;)

script for right mouse commands ?
( work with PtokaX release 0.5.0.0. )

Thanks for assistance..
Best regards,
Massimiliano
Title: Re: Right mouse commands
Post by: BobyJ on 16 March, 2014, 11:34:20
Hi massitux.
I'm still using CustomCmds 2.0 LUA 5.1x [API 2] with PtokaX 0.5.0.1 Lua 5.1.5
Just change the contents (commands) to suit your needs, and it should work.
I hope this help you.



--[[

CustomCmds 2.0 LUA 5.1x [API 2]

by American Idiot 02/22/09

A script to offer custom command context menus [right click]
- Includes full profile table, redundant, yet requested :P
- Sends commands with Zpipe

+Changes from 1.0 02/26/09
- Commands levels
+Added full profile table
+Added check for UserCommand $Support
+Added option for preset menu and or submenu, see notes
+Added notes on command syntax

]]

-- "Command Menu" ["" = hub name]
Menu = ""
-- "Command SubMenu" ["" = script name]
SubMenu = ""

OnStartup = function()
if Menu == "" then Menu = SetMan.GetString(0) end
if SubMenu == "" then SubMenu = "CustomCmds 2.0" end
end
-- added to allow OldUserIP
function UnknownArrival(user,data)
return true
end
--[[
$UserCommand <type> <context> <details>|

<type> What is the command?
0 = separator
1 = raw - Most Commands
2 = mainchat - File Related Commands - to prevent sending command more than once in search results
255 = erase all previous commands

<context> What is the command for?
1 = Hub Command - Hub Settings etc...
2 = User Command - User List - commands with %[nick]
4 = File Command - Search Window
3 = 1 + 2 = Hub and User
5 = 1 + 4 = Hub and File
6 = 2 + 4 = User and File
7 = 1 + 2 + 4 = Hub, User and File

<details> Differs per <type>
<type> 0 = leave blank
<type> 1 = <title>$<command> or <menu>\\<title>$<command> or <menu>\\submenu\\<title>$<command>
<type> 2 = see type 1
<type> 255 = clear all menus

]]


-- Add your own custom commands
-- Typical User Command using preset menu and submenu set above, ending in &#124;|
--{"$UserCommand 1 1 Menu\\SubMenu\\Command Description$<%[mynick]> +command %[line:arg]&#124;|"}
-- Typical User Command using any other string for menu and submenu, ending in &#124;|
--{"$UserCommand 1 1 CustomMenu\\CustomSubMenu\\Command Description$<%[mynick]> +command %[line:arg]&#124;|"}
-- ***Note: Menus and submenus are optional, yet help to organize commands.
CustomCmds = {
[-1] = {
-- "$UserCommand 2 3 Menu\\SubMenu\\Shows Your Online Time in Hub$<%[mynick]> !myhubtime&#124;|",
},
[0] = {
"$UserCommand 2 3 Menu\\SubMenu\\Add Reg User$<%[mynick]> !addreguser %[line:nick] %[line:pass] %[line:profilname]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Add selected User to Reg's$<%[mynick]> !addreguser %[nick] %[line:pass] REG&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Del Reg User$<%[mynick]> !delreguser %[line:nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Full Temp Ban User$<%[mynick]> !fulltempban %[nick] %[line:Time m/h/d/w/M/Y] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Full Ban User$<%[mynick]> !fullban %[nick] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Unban$<%[mynick]> !unban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Perm Unban$<%[mynick]> !permunban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Temp Unban$<%[mynick]> !tempunban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Drop User$<%[mynick]> !drop %[nick] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Info$<%[mynick]> !getinfo %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Bans$<%[mynick]> !getbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Perm Bans$<%[mynick]> !getpermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Temp Bans$<%[mynick]> !gettempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Range Bans$<%[mynick]> !getrangebans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Range Perm Bans$<%[mynick]> !getrangepermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Range Temp Bans$<%[mynick]> !getrangetempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Clear Perm Bans$<%[mynick]> !clrpermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Clear Temp Bans$<%[mynick]> !clrtempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Clear Range Perm Bans$<%[mynick]> !clrrangepermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Clear Range Temp Bans$<%[mynick]> !clrrangetempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Mass Message$<%[mynick]> !massmsg %[line:Message]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Gag User$<%[mynick]> !gag %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\UnGag User$<%[mynick]> !ungag %[nick]&#124;|",
},
[1] = {
"$UserCommand 2 3 Menu\\SubMenu\\Add Reg User$<%[mynick]> !addreguser %[line:nick] %[line:pass] %[line:profilname]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Add selected User to Reg's$<%[mynick]> !addreguser %[nick] %[line:pass] REG&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Del Reg User$<%[mynick]> !delreguser %[line:nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Full Temp Ban User$<%[mynick]> !fulltempban %[nick] %[line:Time m/h/d/w] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Full Ban User$<%[mynick]> !fullban %[nick] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Unban$<%[mynick]> !unban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Perm Unban$<%[mynick]> !permunban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Temp Unban$<%[mynick]> !tempunban %[line:ip or nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Drop User$<%[mynick]> !drop %[nick] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Info$<%[mynick]> !getinfo %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Bans$<%[mynick]> !getbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Perm Bans$<%[mynick]> !getpermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Temp Bans$<%[mynick]> !gettempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Mass Message$<%[mynick]> !massmsg %[line:Message]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Gag User$<%[mynick]> !gag %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\UnGag User$<%[mynick]> !ungag %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Change Your Password$<%[mynick]> !passwd %[line:New Password]&#124;|",
},
[2] = {
"$UserCommand 2 3 Menu\\SubMenu\\Add Reg User$<%[mynick]> !addreguser %[line:nick] %[line:pass] %[line:profilname]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Add selected User to Reg's$<%[mynick]> !addreguser %[nick] %[line:pass] REG&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Bans$<%[mynick]> !getbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Perm Bans$<%[mynick]> !getpermbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Temp Bans$<%[mynick]> !gettempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Drop User$<%[mynick]> !drop %[nick] %[line:Reason]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Info$<%[mynick]> !getinfo %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Change Your Password$<%[mynick]> !passwd %[line:New Password]&#124;|",
},
[3] = {

"$UserCommand 2 3 Menu\\SubMenu\\Get Info$<%[mynick]> !getinfo %[nick]&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Bans$<%[mynick]> !getbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Get Temp Bans$<%[mynick]> !gettempbans&#124;|",
"$UserCommand 2 3 Menu\\SubMenu\\Change Your Password$<%[mynick]> !passwd %[line:New Password]&#124;|",
},
}

UserConnected = function(user)
local cmds = ""
if Core.GetUserValue(user,12) and CustomCmds[user.iProfile] and next(CustomCmds[user.iProfile]) then
for i,v in ipairs(CustomCmds[user.iProfile]) do
cmds = cmds..v:gsub("( Menu\\)"," "..Menu.."\\"):gsub("(\\SubMenu\\)","\\"..SubMenu.."\\")
end
if #cmds > 0 then Core.SendToUser(user,cmds) end
collectgarbage("collect")
end
end
RegConnected,OpConnected = UserConnected,UserConnected



Cheers  :)
Title: Re: Right mouse commands
Post by: FoX on 18 December, 2014, 09:02:42
Thanks  :)