This is User Commands script contains menus for all PtokaX inbuild commands. Is done to show all comands in proper context (hub tab menu, user menu, search menu or filelist menu) and to be easy for next PtokaX release to compress them (in test, PtokaX is able compress 2000 bytes long user commands to only 500 bytes :o) 8)
-- UserCommands for PtokaX 0.3.4.0 and newer by PPK
function NewUserConnected(curUser)
if curUser.bUserCommand then
if curUser.iProfile == -1 then
local usrcmds = "$UserCommand 255 15|$UserCommand 0 3|$UserCommand 1 3 Help$<%[mynick]> !help||$UserCommand 1 3 Show my IP$<%[mynick]> !myip|"
curUser:SendData(usrcmds)
else
SendUserCommands(curUser)
end
end
end
function OpConnected(curUser)
if curUser.bUserCommand then
SendUserCommands(curUser)
end
end
function SendUserCommands(curUser)
permissions = GetProfilePermissions(curUser.iProfile)
local usrcmds = "$UserCommand 255 15|$UserCommand 0 15|$UserCommand 1 3 Help$<%[mynick]> !help||$UserCommand 1 3 Show my IP$<%[mynick]> !myip||$UserCommand 1 1 Set password$<%[mynick]> !passwd %[line:Enter new password]|"
if permissions.bGetInfo then
usrcmds = usrcmds.."|$UserCommand 2 14 Show user info$<%[mynick]> !getinfo %[nick]|"
end
if permissions.bGag then
usrcmds = usrcmds.."|$UserCommand 2 2 Gag menu\\Gag user$<%[mynick]> !gag %[nick]|"
usrcmds = usrcmds.."|$UserCommand 2 2 Gag menu\\Ungag user$<%[mynick]> !ungag %[nick]|"
end
if permissions.bBan then
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Ban user$<%[mynick]> !ban %[nick] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Ban user nick$<%[mynick]> !nickban %[nick] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 3 Ban menu\\Ban IP$<%[mynick]> !banip %[line:Enter an IP to ban] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Full ban user$<%[mynick]> !fullban %[nick] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 3 Ban menu\\Full ban IP$<%[mynick]> !fullbanip %[line:Enter an IP to ban] %[line:Enter a reason]|"
end
if permissions.bTempBan then
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Temp ban user$<%[mynick]> !tempban %[nick] %[line:Enter a time] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Temp ban user nick$<%[mynick]> !nicktempban %[nick] %[line:Enter a time] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 3 Ban menu\\Temp ban IP$<%[mynick]> !tempbanip %[line:Enter an IP to ban] %[line:Enter a time] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 14 Ban menu\\Full temp ban user$<%[mynick]> !fulltempban %[nick] %[line:Enter a time] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 2 3 Ban menu\\Full temp ban IP$<%[mynick]> !fulltempbanip %[line:Enter an IP to ban] %[line:Enter a time] %[line:Enter a reason]|"
end
if permissions.bUnban then
usrcmds = usrcmds.."|$UserCommand 1 3 Ban menu\\Unban$<%[mynick]> !unban %[line:Enter IP or Nick to unban]|"
usrcmds = usrcmds.."|$UserCommand 1 3 Ban menu\\Unban perm ban$<%[mynick]> !permunban %[line:Enter IP or Nick to unban]|"
end
if permissions.bTempUnban then
usrcmds = usrcmds.."|$UserCommand 1 3 Ban menu\\Unban temp ban$<%[mynick]> !tempunban %[line:Enter IP or Nick to unban]|"
end
if permissions.bGetBans then
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Check if is nick banned$<%[mynick]> !checknickban %[line:Enter nick to check]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Check if is IP banned$<%[mynick]> !checkipban %[line:Enter IP to check]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Show ban list$<%[mynick]> !getbans|"
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Show perm bans list$<%[mynick]> !getpermbans|"
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Show temp bans list$<%[mynick]> !gettempbans|"
end
if permissions.bClrPermBan then
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Clear permanent bans$<%[mynick]> !clrpermbans|"
end
if permissions.bClrTempBan then
usrcmds = usrcmds.."|$UserCommand 1 1 Ban menu\\Clear temporary bans$<%[mynick]> !clrtempbans|"
end
if permissions.bRangeBan then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Range ban$<%[mynick]> !rangeban %[line:Enter from IP] %[line:Enter to IP] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Full range ban$<%[mynick]> !fullrangeban %[line:Enter from IP] %[line:Enter to IP] %[line:Enter a reason]|"
end
if permissions.bRangeUnban then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Unban range ban$<%[mynick]> !rangeunban %[line:Enter from IP] %[line:Enter to IP]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Unban permanent range ban$<%[mynick]> !rangepermunban %[line:Enter from IP] %[line:Enter to IP]|"
end
if permissions.bRangeTempBan then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Range temp ban$<%[mynick]> !rangetempban %[line:Enter from IP] %[line:Enter to IP] %[line:Enter a time] %[line:Enter a reason]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Full range temp ban$<%[mynick]> !fullrangetempban %[line:Enter from IP] %[line:Enter to IP] %[line:Enter a time] %[line:Enter a reason]|"
end
if permissions.bRangeTempUnban then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Unban temp range ban$<%[mynick]> !rangetempunban %[line:Enter from IP] %[line:Enter to IP]|"
end
if permissions.bGetRangeBans then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Check if is range banned$<%[mynick]> !checkrangeban %[line:Enter from IP] %[line:Enter to IP]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Show range bans list$<%[mynick]> !getrangebans|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Show range perm bans list$<%[mynick]> !getrangepermbans|"
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Show range temp bans list$<%[mynick]> !getrangetempbans|"
end
if permissions.bClearRangePermBans then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Clear permanent range bans$<%[mynick]> !clrrangepermbans|"
end
if permissions.bClearRangeTempBans then
usrcmds = usrcmds.."|$UserCommand 1 1 Range ban menu\\Clear temporary range bans$<%[mynick]> !clrtempbans|"
end
if permissions.bDrop then
usrcmds = usrcmds.."|$UserCommand 2 14 Drop user$<%[mynick]> !drop %[nick]|"
end
if permissions.bTopic then
usrcmds = usrcmds.."|$UserCommand 1 1 Change topic$<%[mynick]> !topic %[line:Enter new topic]|"
end
if permissions.bMassMsg then
usrcmds = usrcmds.."|$UserCommand 1 1 Send mass message$<%[mynick]> !massmsg %[line:Enter message to send]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Send mass message to OPs$<%[mynick]> !opmassmsg %[line:Enter message to send]|"
end
if permissions.bRefreshTxt then
usrcmds = usrcmds.."|$UserCommand 1 1 Reload text files$<%[mynick]> !reloadtxt|"
end
if permissions.bAddRegUser then
usrcmds = usrcmds.."|$UserCommand 1 1 Registered users menu\\Add registered user$<%[mynick]> !addreguser %[line:Enter nick] %[line:Enter password] %[line:Enter profile name]|"
usrcmds = usrcmds.."|$UserCommand 1 2 Add to registered users$<%[mynick]> !addreguser %[nick] %[line:Enter password] %[line:Enter profile name]|"
end
if permissions.bDelRegUser then
usrcmds = usrcmds.."|$UserCommand 1 1 Registered users menu\\Delete registered user$<%[mynick]> !delreguser %[line:Enter nick]|"
end
if permissions.bTempOP then
usrcmds = usrcmds.."|$UserCommand 1 2 Give user temporary OP$<%[mynick]> !op %[nick]|"
end
if permissions.bRestartScripts then
usrcmds = usrcmds.."|$UserCommand 1 1 Scripts menu\\Start script$<%[mynick]> !startscript %[line:Enter script name]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Scripts menu\\Restart script$<%[mynick]> !restartscript %[line:Enter script name]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Scripts menu\\Restart scripts$<%[mynick]> !restartscripts|"
usrcmds = usrcmds.."|$UserCommand 1 1 Scripts menu\\Stop script$<%[mynick]> !stopscript %[line:Enter script name]|"
usrcmds = usrcmds.."|$UserCommand 1 1 Scripts menu\\Get scripts list$<%[mynick]> !getscripts|"
end
if permissions.bRestartHub then
usrcmds = usrcmds.."|$UserCommand 1 1 Restart hub$<%[mynick]> !restart|"
end
curUser:SendData(usrcmds)
end
Or download it here (http://www.ptokax.org/files/Scripts/UserCommands.lua). If you find any bugs please report them here.
;) thanks
Hey PPK,
Not sure if it's a bug or not, but when using these rightclick commands, all rightclick commands from my other scripts disappeared? :'(
When I moved your rightclicks to the top of the scripts lists, the others came back? ;D
Any clue on why ?
$UserCommand 255 <context> |
Will erase all commands that the hub has sent previously. This is for hubs/scripts that allow for updates while running. The erase all is intentional, keeping it simple. Note that contexts must still be used, and that erasing will remove all commands that match any of those ORed contexts (i.e. 7 will remove commands previously sent with any context of 1 through 7) but only from that context
Source (http://www.dcpp.net/wiki/index.php/%24UserCommand)
this work fine
it is not complete more commands needed type setminslot -setmaxslot- setminshare - setmaxshare - setminhub and setmaxhub
tnx
Quote from: Helios on 20 June, 2006, 17:17:53
this work fine
it is not complete more commands needed type setminslot -setmaxslot- setminshare - setmaxshare - setminhub and setmaxhub
tnx
feel free to update and post it then ;)
Those commands are not inbuild commands. Btw here is a small script to add to the rightclickmenu all the scripts which are in the scripts folder:
-- LUA scripts in rightclick menu
-- All LUA-script, which is on the scripts folder,
-- will send to the operator, when connects.
-- Based on vh_lua_manager.lua by Ro
-- Made by Hungarista
-- 2006.06.19
function OpConnected(curUser)
local permission = GetProfilePermissions(curUser.iProfile)
if permission.bRestartScripts then
os.execute("dir /B /ON "..string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."scripts\\ > lualist.txt")
curUser:SendData("$UserCommand 1 3 "..frmHub:GetHubName().."\\Scripts\\Get scripts$<%[mynick]> !getscripts||")
curUser:SendData("$UserCommand 1 3 "..frmHub:GetHubName().."\\Scripts\\Restart scripts$<%[mynick]> !restartscripts||")
curUser:SendData("$UserCommand 0 3|")
local command = "!startscript"
local stat = "start"
SendUsercommands(curUser,command,stat)
curUser:SendData("$UserCommand 0 3|")
local command = "!stopscript"
local stat = "stop"
SendUsercommands(curUser,command,stat)
end
end
function SendUsercommands(curUser,command,stat)
local file = io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."scripts\\lualist.txt", "r")
if (file) then
local line = file:read()
while line do
if (string.sub(line, (string.len(line)-2), string.len(line)) == "lua") then
curUser:SendData("$UserCommand 1 3 "..frmHub:GetHubName().."\\Scripts\\"..stat.."\\"..line.." "..stat.."$<%[mynick]> "..command.." "..line.."||")
end
line = file:read()
end
file:close()
end
end
tnx for the help
a complete script is by pothead called commands it is posted here
the script report me this error : Syntax F:\recupero\Ptokax\Ptokax\scripts\commands.lua:442: bad argument #1 to 'pairs' (table expected, got function)
any1 correct this
tnx 1000