Hi all,
I'd like to add a new command for my OPs.
A command wich give the number of a user's shared slots... as '+nbslots '
Is someone knows haw to parse the $SR command in order to find the good information?
if you mean the amount of uploads slots then give this a try.
TheCommand = "+nbslots"
function DataArival(user, data)
if user.bOperator ~= nil then
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, (strlen(data)-1))
s,e,cmd,who = strfind(data, "%b<>%s+(%S+)%s*(%S*)")
if cmd == TheCommand then
if who == "" then
user:SendData("Slots", "I really need to know a username as i'm not psychic|")
else
victem = GetItemByName(who)
if victem == nil then
user:SendData("Slots", who.." is not in the hub|")
else
local _,b, slots = strfind(victem.sMyInfoString,"S:(%x+)")
if slots ~= nil then
user:SendData("Slots", who.." has "..slots.." upload slots|")
end
end
end
end
end
end
end
if you want 2 see the amount of used/free slots i have some more work 2 do. lol
plop
I think it's what I search for, but how does it work ? :D
When I type '+nbslots' or '+nbslots xjr13sp 'in the main chat I have no responses :(
sorry spelling error on DataArrival seems that that is spelled with 2 r's. lol
Bot = "Slots"
TheCommand = "+nbslots"
function DataArrival(user, data)
if user.bOperator ~= nil then
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, (strlen(data)-1))
s,e,cmd,who = strfind(data, "%b<>%s+(%S+)%s*(%S*)")
if cmd == TheCommand then
if who == "" then
user:SendData(Bot, "I really need to know a username as i'm not psychic|")
else
victem = GetItemByName(who)
if victem == nil then
user:SendData(Bot, who.." is not in the hub|")
else
local _,b, slots = strfind(victem.sMyInfoString,"S:(%x+)")
if slots ~= nil then
user:SendData(Bot, who.." has "..slots.." upload slots|")
end
end
end
return 1
end
end
end
end
plop
Hi,
I tested your changes, but it doesn't work more :(
I have this :
+nbslots
I really need to know a username as i'm not psychic
+nbslots ludo
(no response with this last command)
funny works here.
next try, this gives output if no slots were found, maby it can help 2 find the error.
Bot = "Slots"
TheCommand = "+nbslots"
function DataArrival(user, data)
if user.bOperator ~= nil then
if (strsub(data, 1, 1) == "<") then
data = strsub(data, 1, (strlen(data)-1))
s,e,cmd,who = strfind(data, "%b<>%s+(%S+)%s*(%S*)")
if cmd == TheCommand then
if who == "" then
user:SendData(Bot, "I really need to know a username as i'm not psychic|")
else
victem = GetItemByName(who)
if victem == nil then
user:SendData(Bot, who.." is not in the hub|")
else
local _,b, slots = strfind(victem.sMyInfoString,"S:(%d+)")
if slots ~= nil then
user:SendData(Bot, who.." has "..slots.." upload slots|")
else
user:SendData(Bot, who.." made me confused, couldn't find his slots|")
end
end
end
return 1
end
end
end
end
plop
It seems to work prefectly!!
Thank you plop :))