PtokaX forum

Development Section => Your Developing Problems => Topic started by: NightLitch on 04 November, 2003, 20:45:15

Title: Resolve Right Klick Kick in Client... plz help
Post by: NightLitch on 04 November, 2003, 20:45:15
This is my Code

elseif strsub(data,1,6) == "$Kick " then
doRightKick(curUser, data)
return 1

function doRightKick(curUser, data)
data=strsub(data,1,strlen(data)-1)
s,e,whom = strfind(data,"$Kick%s+(.*)")
if GetItemByName(whom) then
whom=GetItemByName(whom)
if whom.bOperator then
return 1
else
local f = openfile("GR8-files/kicks.dat", "a")
if f then
write(f, whom.." "..whom.sIP.." "..reason.."\r\n")
closefile(f)
end
whom:TempBan()
end
end
end


How do I get the reson to work from Client so it is being registred into my file... plz help me out...

/NightLitch
Title:
Post by: NightLitch on 04 November, 2003, 20:56:34
ptaczek someone plz help, can't be that hard but I just can't the thing to work...

want to register the reason as well as Nick & IP...

Nick & IP is no problem but reason is...

So help me....

/NIghtLitch
Title:
Post by: Tuben on 04 November, 2003, 21:01:15
[20:56] 213.113.240.234:2294 > <[BBB]> [BBB] is kicking martinez because: |


elseif strsub(data,1,6) == "$Kick " then
doRightKick(curUser, data,Reason)
return 1
elseif (strsub(data,1,8) ==  "because:") then
 local _,_, Reason = strfind(data,is kicking%s+%S+%s+because:(.*)")
if Reason ~= nil then
doRightKick(curUser, data,Reason)
end

function doRightKick(curUser, data,Reason)
data=strsub(data,1,strlen(data)-1)
s,e,whom = strfind(data,"$Kick%s+(.*)")
if GetItemByName(whom) then
whom=GetItemByName(whom)
if whom.bOperator then
return 1
else
local f = openfile("GR8-files/kicks.dat", "a")
if f then
write(f, whom.." "..whom.sIP.." "..Reason.."\r\n")
closefile(f)
end
whom:TempBan()
end
end
end


Untested 100%

But somthing like that.
Title:
Post by: NightLitch on 04 November, 2003, 21:03:00
Gonna test thx...
Title:
Post by: NightLitch on 04 November, 2003, 21:07:49
Was sceptic from the beginning with this solusions...

This aint working att all... becouse of double arrivals:


   elseif strsub(data,1,6) == "$Kick " then
      doRightKick(curUser, data)
      return 1
   elseif (strsub(data,1,8) ==  "because:") then
       local _,_,Reason = strfind(data,"is kicking%s+%S+%s+ because:(.*)")
      if Reason ~= nil then
         doRightKick(curUser, data,Reason)
      end
      return 1


/NightLitch
Title:
Post by: NightLitch on 04 November, 2003, 21:28:19
plz, guys help me out... How am I gonna do the:

STRFIND -line

have tried many way's but... no success....

/NightLitch
Title:
Post by: Tuben on 04 November, 2003, 21:45:08
OK..

This then.

"Edit" To fast. ;)

elseif strfind(data,"You are being kicked because:") then
 local _,_, Name,Op,Reason = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$<%S+> You are being kicked because:%s+(.*)|")
  if Name~=nil and Op~=nil and Reason~=nil then
OpCheck = GetItemByName(Op)
        if OpCheck~=nil and OpCheck.bOperator then
            User = GetItemByName(Name)
            if User~=nil then
              local f = openfile("kicks.txt","a")
              write(f,""..User.sName.." "..User.sIP.." "..Reason.."\r\n")
     closefile(f)
     end          
   end
 end
         end

Title:
Post by: NightLitch on 04 November, 2003, 21:55:29
THX Tuben.... work as I wanted to now after some changes....

/NightLitch