i wonder if there are away to do prefix in command
like that here
if cmd == prefix.."myip" then
hi m8
what exactly do you mean ???
i mean that
function UserCommands(user,data,cmd)
if cmd == prefix "+myip" then
user:SendData(Bot, " Your Ip is -=-=> "..user.sIP)
return 1
and then have 2 prefix
Prefix = {
["+"] = 1,
["!"] =,
}
maby something like this will help
local _,_,PrefixToCheck = strfind(data, "%b<>%s+(%S)")
if Prefix[PrefixToCheck] then
--- Do your command checks here
end
using table
Prefix = {
["+"] = 1,
["!"] =1,
}
ok..i will try it out and see if i it work's
Nope that did not work
hmmm works here m8 ....
can you post the script ...
function DataArrival(user, data)
if (strsub(data,1,7) == "$MyINFO") then
Tag,Speed,Share = Parse(data)
TagCheck(Tag,Speed,Share,user)
end
if Kennylizednicks[user.sName] == 1 then
text=kennytext[random(1, getn(kennytext))]
SendToAll(user.sName, text)
return 1
elseif MUTE[user.sName] == 1 then
user:SendData(Bot,"You are muted. your message has been blocked ! ! !")
return 1
elseif drunknicks[user.sName] == 1 then
text=DrunkText[random(1, getn(DrunkText))]
SendToAll(user.sName, text)
return 1
end
if (strsub(data, 1, 1) == "<" ) then
local data=strsub(data,1,strlen(data)-1)
local _,_,cmd=strfind(data, "%b<>%s+(%S+)")
local Commands = (UserCommands(user, data, cmd))
return Commands
elseif (strsub(data,1,4) == "$To:") then
data = strsub(data,1,-2);
local s,e,whoTo,from,arg = strfind(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)")
local s,e,cmd = strfind(arg,"(%S+)")
if (whoTo == Bot) then
UserCommands(user,data,cmd)
elseif(whoTo == fBot) then
UserCommands(user,data,cmd)
else
for i=1,getn(ChatBots) do
if (( whoTo == ChatBots[i].Name )) then
if (( ChatBots[i].Allowed[user.iProfile] == 1 )) then
sChat = ChatBots[i].Name;
for b,v in ChatBots[i].Allowed do
if (( v == 1 )) then
ChatRoom(sChat,user,arg,b)
end
end
end
end
end
end
end
end
function UserCommands(user,data,cmd)
if cmd == "+myip" then
user:SendData(Bot, " Your IP is -=-=> "..user.sIP)
return 1
end
end
try this :-
function DataArrival(user, data)
if (strsub(data,1,7) == "$MyINFO") then
Tag,Speed,Share = Parse(data)
TagCheck(Tag,Speed,Share,user)
end
if Kennylizednicks[user.sName] == 1 then
text=kennytext[random(1, getn(kennytext))]
SendToAll(user.sName, text)
return 1
elseif MUTE[user.sName] == 1 then
user:SendData(Bot,"You are muted. your message has been blocked ! ! !")
return 1
elseif drunknicks[user.sName] == 1 then
text=DrunkText[random(1, getn(DrunkText))]
SendToAll(user.sName, text)
return 1
end
if (strsub(data, 1, 1) == "<" ) then
local data=strsub(data,1,strlen(data)-1)
local _,_,PrefixToCheck=strfind(data, "%b<>%s+(%S)")
if Prefix[PrefixToCheck] then
local _,_,cmd=strfind(data, "%b<>%s+%S(%S+)")
local Commands = (UserCommands(user, data, cmd))
return Commands
end
elseif (strsub(data,1,4) == "$To:") then
data = strsub(data,1,-2);
local s,e,whoTo,from,arg = strfind(data,"%$To:%s+(%S+)%s+From:%s+(%S+)%s+%$%b<>%s+(.*)")
local s,e,cmd = strfind(arg,"(%S+)")
if (whoTo == Bot) then
UserCommands(user,data,cmd)
elseif(whoTo == fBot) then
UserCommands(user,data,cmd)
else
for i=1,getn(ChatBots) do
if (( whoTo == ChatBots[i].Name )) then
if (( ChatBots[i].Allowed[user.iProfile] == 1 )) then
sChat = ChatBots[i].Name;
for b,v in ChatBots[i].Allowed do
if (( v == 1 )) then
ChatRoom(sChat,user,arg,b)
end
end
end
end
end
end
end
end
function UserCommands(user,data,cmd)
if cmd == "myip" then
user:SendData(Bot, " Your IP is -=-=> "..user.sIP)
return 1
end
end
Prefix = {
["!"] = 1,
["+"] = 1,
["?"] = 1
}
You must also remove the + cmd == "+myip" <-> cmd == "myip"
function UserCommands(user,data,cmd)
if cmd == "myip" then
user:SendData(Bot, " Your Ip is -=-=> "..user.sIP)
return 1
elseif cmd == "rules" then
Nope it not work with ? and ! but work with +
sorry above post edited ;)
that ok..m8
i was just a test i 2 see if it will do
yups all workin ok now ??
you probably spotted that not only the prefix from the command had to be removed but it also had to be removed from the cmd
local _,_,cmd=strfind(data, "%b<>%s+%S(%S+)")
or Ignored as in the above