Im making my own userinfo script just for fun and its almost finished, except when you use the command, it shows your own userinfo, not the username you wrote. Can anyone help me, because I cant see whats wrong, I must be blind :P-- Userinfo 1.0 by blackwings
sBot = "#userinfo"
tPrefix = frmHub:GetPrefixes()
function ChatArrival(user, data)
return CmdUserInfo(user,data)
end
function ToArrival(user,data)
return CmdUserInfo(user,data)
end
function CmdUserInfo(user, data)
local s,e,Cmd,Name = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
local sCounter = 0
if IfValidCMD(Cmd, "userinfo") and user.bOperator then
return theUserInfo(user, data)
end
end
function IfValidCMD(sIsCMD, sWhatCMD)
for sIndex in tPrefix do
if sIsCMD == (tPrefix[sIndex]..sWhatCMD) then
return 1
end
end
end
cMode = ""
cDesc = ""
cEmail = ""
function theUserInfo(user, data)
cProfileNr = GetUserProfile(user.sName)
cProfile = GetProfileName(cProfileNr)
unitGB = 1073741824
cShare = user.iShareSize/unitGB
cShareSize = string.format("%0.2f %s",cShare,"")
if user.bActive then
cMode = "Active"
elseif not user.bActive then
cMode = "Passive"
end
if user.sDescription=="" then
cDesc = "None"
elseif not user.sDescription=="" then
cDesc = user.sDescription
end
if user.sEmail=="" then
cEmail = "None"
elseif not user.sEmail=="" then
cEmail = user.sEmail
end
cMsg = "\r\n\r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t # User info ########################## \r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t - Username: "..user.sName.." \r\n"
cMsg = cMsg.."\t - User Profile: "..cProfile.." \r\n"
cMsg = cMsg.."\t - User IP: "..user.sIP.." \r\n"
cMsg = cMsg.."\t - Client: "..user.sClient.." \r\n"
cMsg = cMsg.."\t - Version: "..user.sClientVersion.." \r\n"
cMsg = cMsg.."\t - User iVersion: "..user.iVersion.." \r\n"
cMsg = cMsg.."\t - User description: "..cDesc.." \r\n"
cMsg = cMsg.."\t - User Tag: "..user.sTag.." \r\n"
cMsg = cMsg.."\t - Mode: "..cMode.." \r\n"
cMsg = cMsg.."\t - Connection: "..user.sConnection.." \r\n"
cMsg = cMsg.."\t - User email: "..cEmail.." \r\n"
cMsg = cMsg.."\t - Share Size: "..cShareSize.." \r\n"
cMsg = cMsg.."\t ----------- \r\n"
cMsg = cMsg.."\t - Normal Hub Count: "..user.iNormalHubs.." \r\n"
cMsg = cMsg.."\t - Regged Hub Count: "..user.iRegHubs.." \r\n"
cMsg = cMsg.."\t - Operator Hub Count: "..user.iOpHubs.." \r\n"
cMsg = cMsg.."\t - Total Hub Count: "..user.iHubs.." \r\n"
cMsg = cMsg.."\t - Slots Count: "..user.iSlots.." \r\n"
cMsg = cMsg.."\t ---------------------------------------------------- \r\n"
user:SendPM(sBot, cMsg)
return 1
end
You are getting all the info of user instead of Name. :)
QuoteOriginally posted by Pothead
You are getting all the info of user instead of Name. :)
First I did this =
return theUserInfo(user, data, Name)
function theUserInfo(user, data, Name)
end
then I changed all .user to .Name in function theUserInfo(). But it didn't work and I get this error message =
[15:55] Syntax C:\ptokax\scripts\userinfo.lua:35: attempt to index local `Name' (a string value)
u got it all wrong the prob is here
return theUserInfo(user, data)
hint :
first of all uve got to think like this, there are two user names, one who is sending and one who is receiving :)
Try sommit like this: :)
function CmdUserInfo(user, data)
local s,e,Cmd,NameInText = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
local sCounter = 0
if IfValidCMD(Cmd, "userinfo") and user.bOperator then
local ActualUser = GetItemByName(NameInText)
return theUserInfo(user, data, ActualUser)
end
end
***Edit***Maybe need to check if the user is actually online, to stop if trying to perform operations on a NIL value. :)
Try something like this ..
ive not tested it .. but its closer to what your aiming at
-- Userinfo 1.0 by blackwings
sBot = "#userinfo"
tPrefix = frmHub:GetPrefixes()
function ChatArrival(user, data)
return CmdUserInfo(user,data)
end
function ToArrival(user,data)
return CmdUserInfo(user,data)
end
function CmdUserInfo(user, data)
local s,e,Cmd,Name = string.find( data, "%b<>%s+(%S+)%s+(%S+)" )
local sCounter = 0
if IfValidCMD(Cmd, "userinfo") and user.bOperator then
return theUserInfo(user, data, Name)
end
end
function IfValidCMD(sIsCMD, sWhatCMD)
for sIndex in tPrefix do
if sIsCMD == (tPrefix[sIndex]..sWhatCMD) then
return 1
end
end
end
cMode = ""
cDesc = ""
cEmail = ""
function theUserInfo(user, data, Name)
local INFO = GetItemByName(Name)
if INFO == nil then
curUser:SendData(bot_name1,"The user is offline..!")
return 1
end
cProfileNr = GetUserProfile(INFO.sName)
cProfile = GetProfileName(cProfileNr)
unitGB = 1073741824
cShare = INFO.iShareSize/unitGB
cShareSize = string.format("%0.2f %s",cShare,"")
if INFO.bActive then
cMode = "Active"
elseif not INFO.bActive then
cMode = "Passive"
end
if INFO.sDescription=="" then
cDesc = "None"
elseif not INFO.sDescription=="" then
cDesc = INFO.sDescription
end
if INFO.sEmail=="" then
cEmail = "None"
elseif not INFO.sEmail=="" then
cEmail = INFO.sEmail
end
cMsg = "\r\n\r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t # User info ########################## \r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t - Username: "..INFO.sName.." \r\n"
cMsg = cMsg.."\t - User Profile: "..cProfile.." \r\n"
cMsg = cMsg.."\t - User IP: "..INFO.sIP.." \r\n"
cMsg = cMsg.."\t - Client: "..INFO.sClient.." \r\n"
cMsg = cMsg.."\t - Version: "..INFO.sClientVersion.." \r\n"
cMsg = cMsg.."\t - User iVersion: "..INFO.iVersion.." \r\n"
cMsg = cMsg.."\t - User description: "..cDesc.." \r\n"
cMsg = cMsg.."\t - User Tag: "..INFO.sTag.." \r\n"
cMsg = cMsg.."\t - Mode: "..cMode.." \r\n"
cMsg = cMsg.."\t - Connection: "..INFO.sConnection.." \r\n"
cMsg = cMsg.."\t - User email: "..cEmail.." \r\n"
cMsg = cMsg.."\t - Share Size: "..cShareSize.." \r\n"
cMsg = cMsg.."\t ----------- \r\n"
cMsg = cMsg.."\t - Normal Hub Count: "..INFO.iNormalHubs.." \r\n"
cMsg = cMsg.."\t - Regged Hub Count: "..INFO.iRegHubs.." \r\n"
cMsg = cMsg.."\t - Operator Hub Count: "..INFO.iOpHubs.." \r\n"
cMsg = cMsg.."\t - Total Hub Count: "..INFOr.iHubs.." \r\n"
cMsg = cMsg.."\t - Slots Count: "..INFO.iSlots.." \r\n"
cMsg = cMsg.."\t ---------------------------------------------------- \r\n"
user:SendPM(sBot, cMsg)
return 1
end
lol, hawk and pothead ur "spoon feeding" him, hes trying to learn, its better to give hint than the answer :)
QuoteOriginally posted by Dessamator
lol, hawk and pothead ur "spoon feeding" him, hes trying to learn, its better to give hint than the answer :)
Maby BUT it is blackwings ( not a Noob ) , he will still learn from it. :P
hmm, indeed maybe im wrong in this case :)
thanx you, hawk,Pothead & Dessamator. hmm, that was pretty obvious, I should have seen that :rolleyes: .
I also noticed another couple of problems too which I fixed :D
One of them was the way I checked the profile on the target. Anyway its fixed and here is the code if anyone is interested :P = -- Userinfo 1.3 by blackwings
-- FIXED: bug in local s,e,Cmd, Name
-- FIXED: bug with targets profile which caused problems
-- FIXED: bug with targets username - Thx ??????Hawk??????
sBot = "#userinfo"
tPrefix = frmHub:GetPrefixes()
function ChatArrival(user, data)
return CmdUserInfo(user,data)
end
function ToArrival(user,data)
return CmdUserInfo(user,data)
end
function CmdUserInfo(user, data)
local s,e,Cmd, Name = string.find(data, "%b<>%s+(%S+)%s*(%S*).*|")
if IfValidCMD(Cmd, "userinfo") and user.bOperator then
return theUserInfo(user, data, Name)
end
end
function IfValidCMD(sIsCMD, sWhatCMD)
for sIndex in tPrefix do
if sIsCMD == (tPrefix[sIndex]..sWhatCMD) then
return 1
end
end
end
cMode = ""
cDesc = ""
cEmail = ""
cProfile = ""
function theUserInfo(user, data, Name)
local onWho = GetItemByName(Name)
if onWho == nil then
user:SendData(sBot,"The user is offline..!")
return 1
end
if onWho.iProfile==0 then
cProfile = "Master"
elseif onWho.iProfile==1 then
cProfile = "Operator"
elseif onWho.iProfile==2 then
cProfile = "VIP"
elseif onWho.iProfile==3 then
cProfile = "REG"
elseif onWho.iProfile==-1 then
cProfile = "Normal"
end
unitGB = 1073741824
cShare = onWho.iShareSize/unitGB
cShareSize = string.format("%0.2f %s",cShare,"")
if onWho.bActive then
cMode = "Active"
elseif not onWho.bActive then
cMode = "Passive"
end
if onWho.sDescription=="" then
cDesc = "None"
elseif not onWho.sDescription=="" then
cDesc = onWho.sDescription
end
if onWho.sEmail=="" then
cEmail = "None"
elseif not onWho.sEmail=="" then
cEmail = onWho.sEmail
end
cMsg = "\r\n\r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t # User info ########################## \r\n"
cMsg = cMsg.."\t ################################## \r\n"
cMsg = cMsg.."\t - Username: "..onWho.sName.." \r\n"
cMsg = cMsg.."\t - User Profile: "..cProfile.." \r\n"
cMsg = cMsg.."\t - User IP: "..onWho.sIP.." \r\n"
cMsg = cMsg.."\t - Client: "..onWho.sClient.." \r\n"
cMsg = cMsg.."\t - Version: "..onWho.sClientVersion.." \r\n"
cMsg = cMsg.."\t - User iVersion: "..onWho.iVersion.." \r\n"
cMsg = cMsg.."\t - User description: "..cDesc.." \r\n"
cMsg = cMsg.."\t - User Tag: "..onWho.sTag.." \r\n"
cMsg = cMsg.."\t - Mode: "..cMode.." \r\n"
cMsg = cMsg.."\t - Connection: "..onWho.sConnection.." \r\n"
cMsg = cMsg.."\t - User email: "..cEmail.." \r\n"
cMsg = cMsg.."\t - Share Size: "..cShareSize.." \r\n"
cMsg = cMsg.."\t ----------- \r\n"
cMsg = cMsg.."\t - Normal Hub Count: "..onWho.iNormalHubs.." \r\n"
cMsg = cMsg.."\t - Regged Hub Count: "..onWho.iRegHubs.." \r\n"
cMsg = cMsg.."\t - Operator Hub Count: "..onWho.iOpHubs.." \r\n"
cMsg = cMsg.."\t - Total Hub Count: "..onWho.iHubs.." \r\n"
cMsg = cMsg.."\t - Slots Count: "..onWho.iSlots.." \r\n"
cMsg = cMsg.."\t ---------------------------------------------------- \r\n"
user:SendPM(sBot, cMsg)
return 1
end