PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: ruler on 10 September, 2006, 19:20:58

Title: [SOLVED]Redirect question
Post by: ruler on 10 September, 2006, 19:20:58
ok ive been trying to work this one out (maybe ive been looking at this too long  ;D) but its got the best of me now so im gonna ask away here  :)

this is the function i am working with...

function OpForceMoveArrival(user, data)
if hublock == "enable" then
   if user.iProfile ~= 0 then
   return 1
   end
end
          if string.sub(data, 1, 12) == "$OpForceMove" then
-- 'here is want to get the profile of the nick that is being redirected'
                    if user.iProfile > RedirectedUser.iPorfile then
                    return 1
                    end
          end
end

its the part in written in red i cant seem to do, i am trying to get the profile number of the nick that is being redirected  ??? beats me  ;D
Title: Re: Redirect question
Post by: Thor on 10 September, 2006, 19:32:59
Find the RedirectedUser's name in the data with a simple string.find pattern, and then use GetItemByName(RedirectedUser) which return with the userobject, if the user is online, else with nil. So if it's not nil, you can use then:
if user.iProfile > RedirectedUser.iProfile then
Title: Re: Redirect question
Post by: ruler on 10 September, 2006, 19:37:39
its the string.find pattern i am having problems with, i can get the profile once i can find the nick within the string
Title: Re: Redirect question
Post by: Thor on 10 September, 2006, 20:21:40
Try with it:local _,_,RedirectedUser = string.find(data,"^%$OpForceMove %$Who:(%S+)%$Where:")
Title: Re: Redirect question
Post by: ruler on 10 September, 2006, 20:31:39
yup that worked perfect, thanks  :)