PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: juda on 02 February, 2005, 19:01:35

Title: Need simple bot - IP BoT
Post by: juda on 02 February, 2005, 19:01:35
Hay !!!
 I run PtokaX hub and use inbuild commands,but I miss command:
 ---  !myip   to show IP only to user who use command
-----------------------------------------------------------
 YOUR IP IS:  193.xxx.xxx.xxx
-----------------------------------------------------------
     
Can someone help me and write script for me or give me some tips...
I search,but it is all big bots....

         Thanks for help
Title:
Post by: bastya_elvtars on 02 February, 2005, 19:20:21
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind(data,"%b<>%s+[%!%+%#](%S+)")
if cmd=="myip" then
user:SendData("IP-Bot","Your IP address is "..user.sIP)
return 1
end
end
end


Didn't test, hope it works.
Title:
Post by: Herodes on 02 February, 2005, 19:22:07
try this one.. .
function DataArrival(user, data)
if strsub(data, 1,1) == "<" then
local s,e,cmd = strfind(data, "%b<>%s[!%-%+%?](%S+)")
if cmd == "myip" then
user:SendData( "YourIP", "is "..user.sIP)
end
end
end

[*edit*] Hahahahahah we almost came up with the same script baster  :D
Title:
Post by: juda on 02 February, 2005, 19:38:30
Thanks man...

  The first one code work good...
   second not work... thank you
Title:
Post by: VidFamne on 02 February, 2005, 19:41:16
function DataArrival(user, data)
if strsub(data, -6,-2) == "!myip" then
user:SendData( "IP-Bot", "Your current IP is;  "..user.sIP)
end
end
Does this work, perhaps? ;D
Title:
Post by: juda on 02 February, 2005, 19:48:27
VidFamne - ye man   your script work good !
Title:
Post by: bastya_elvtars on 02 February, 2005, 20:52:16
QuoteOriginally posted by Herodes
try this one.. .
function DataArrival(user, data)
if strsub(data, 1,1) == "<" then
-- sumthin is missing from here // BE
local s,e,cmd = strfind(data, "%b<>%s[!%-%+%?](%S+)")
if cmd == "myip" then
user:SendData( "YourIP", "is "..user.sIP)
end
end
end

[*edit*] Hahahahahah we almost came up with the same script baster  :D

Yea, you just missed the line that makes it work! :D

data=strsub(data,1,strlen(data)-1)
Damn man, we are getting rusty! ;) Seems 1.5 months without DC kill me...

*logs off and goes to commit suicide*
Title:
Post by: Herodes on 02 February, 2005, 22:06:46
QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by Herodes
try this one.. .
function DataArrival(user, data)
if strsub(data, 1,1) == "<" then
-- sumthin is missing from here // BE
local s,e,cmd = strfind(data, "%b<>%s[!%-%+%?](%S+)")
if cmd == "myip" then
user:SendData( "YourIP", "is "..user.sIP)
end
end
end

[*edit*] Hahahahahah we almost came up with the same script baster  :D

Yea, you just missed the line that makes it work! :D

data=strsub(data,1,strlen(data)-1)
Damn man, we are getting rusty! ;) Seems 1.5 months without DC kill me...

*logs off and goes to commit suicide*
Sure thing man .. havent scripted for a long time too ...