PtokaX forum

Development Section => Your Developing Problems => Topic started by: ((UKSN))shad_dow on 31 January, 2004, 14:21:44

Title: Some One Please Check This .... Im Confused
Post by: ((UKSN))shad_dow on 31 January, 2004, 14:21:44
hi chilla , Plop , Phatty , Kepp , tezlo
and Nightlitch

hope ya can help me please.


if (cmd == "+ipbann" ) then
IpBanN(user, data,cmd)

                                return 1
end


function IpBanN(user, data,cmd)

         s,e,cmd,Ip = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s+.+")
local UserIp = Ip
              UserIp:Ban()
SendToAll(Bot, " IP "..UserIp " has been  banned ")
end


Syntax Error: attempt to index local `Ip' (a nil value)

right 1) tryed to create the strfind with the little guide i got from plop .. but me thinks i aint got it quite right  and its not getting the value  

or

2) this line is wrong> local UserIp = Ip  

or

3) ive missed a bit of code out (hand coded stright from my mem)

please help as im confused as what to do

Title:
Post by: pHaTTy on 31 January, 2004, 14:28:27
first of all go check the hows goto lesson 1 on writing a bot, so you can understand the data arrival process and as for banip i not sure there is an external command for that, i think you have to ban the with ip im not to sure :/
Title:
Post by: ((UKSN))shad_dow on 31 January, 2004, 14:33:44
cheers phatty , think i go over the lessons again , good job i printed them out :) ...

shame ther aint a way to !ipban ip and it just ban the ip u typed in , just like the hub does ??? mmmm

thats all i was doing seeing if i could code in to a script the same commands as in ptokax , just using diffent prefix .. thourght it might make me better @ coding :)

ps.. thank u for ur quick responce :)
Title:
Post by: kepp on 31 January, 2004, 16:09:15
have you tried "Ban(UserIp)"?

HINT:

I want to find "0.54.1"

local s,e,cmd,IP = strfind(data,"%b<>%s+(%d.%d+.%d)")

%d = numbers

Now go try :P
Title:
Post by: pHaTTy on 31 January, 2004, 16:16:22
QuoteOriginally posted by kepp
have you tried "Ban(UserIp)"?


that shudnt work :S, if it does you tought me sumit new :)
Title:
Post by: plop on 31 January, 2004, 16:58:28
banning ip's is imposible from the scripts.

kepp you can do this easyer.
local s,e,cmd,IP = strfind(data,"%b<>%s+(%d.%d+.%d)")
replace for.

local s,e,cmd,IP = strfind(data,"%b<>%s+(%S+)%s+([%d%.]+)")

plop
Title:
Post by: kepp on 31 January, 2004, 17:14:32
ok, lol, i've never tried myself.. ,
That reminds me of something, I gotta check that post of your again! :)