PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: Plagued Elohim on 18 April, 2007, 17:30:09

Title: Help :(
Post by: Plagued Elohim on 18 April, 2007, 17:30:09
hi there... Could someone please help me with a script? I would like a script so that when I type wrong a command, like ' !kik ' in stead of ' !kick ' won't appear in mainchat to all the users but only to me with a reply like ' Unknown command, please try to be more careful when you type ' or something like that. Could it be possible? Thank You :)
Title: Re: Help :(
Post by: achiever on 18 April, 2007, 17:33:40
lol, please read the other help topic on  LUA & PtokaX-Scripting-Interface
i think it will help u
Title: Re: Help :(
Post by: Plagued Elohim on 18 April, 2007, 17:45:57
uhm... I'm not quite finding anything... could you please post the script?  :'(
Title: Re: Help :(
Post by: achiever on 18 April, 2007, 17:51:11
sBot = "Fusion"
Commands = {
["myip"] = 1, -- add ur commands here in the same format
["stat"] = 1,
["reloadtxt"] = 1,
["getscripts"] = 1,
["restartscripts"] = 1,
["clrrangetempbans"] = 1,
["clrtempbans"] = 1,
["clrrangepermbans"] = 1,
["clrpermbans"] = 1,
["fav"] = 1,
["getrangebans"] = 1,
["getrangepermbans"] = 1,
["getpermbans"] = 1,
["getrangetempbans"] = 1,
["gettempbans"] = 1,
["help"] = 1,
}

function ChatArrival( user, data)
local s,e,prefix,cmd = data:find("%b<>%s+(%p)(%S+)|")
if not Commands[cmd] then
if prefix and cmd then
SendToAll(sBot, "Type prefix-help for list of commands available to ur profile") -- and ur mesg here
return 1
end
end
end


give this a try or u can still w8 for scripters to post something better
Title: Re: Help :(
Post by: Plagued Elohim on 18 April, 2007, 18:22:49
uhm... when I type the wrong command the other users can see it ... could you fix that so the users won't see the wrong command? please  :'(
Title: Re: Help :(
Post by: achiever on 18 April, 2007, 18:36:32
previous code updated
Title: Re: Help :(
Post by: Plagued Elohim on 18 April, 2007, 18:44:40
one last thing :) could you make it so the 'one hand writing sees the message ' Type prefix-help for list of commands available to ur profile ' ? Thank you :) oh and... when I type another parameter the wrong command still shows up :(
Title: Re: Help :(
Post by: achiever on 18 April, 2007, 19:03:13
this time u will have to w8 for some scripter to help, i m unable to this
Title: Re: Help :(
Post by: Plagued Elohim on 18 April, 2007, 19:19:22
oky, I will wait  :) thank you  :D
Title: Re: Help :(
Post by: Naithif on 18 April, 2007, 19:57:53
Quote from: Plagued Elohim on 18 April, 2007, 18:44:40
one last thing :) could you make it so the 'one hand writing sees the message ' Type prefix-help for list of commands available to ur profile ' ? Thank you :) oh and... when I type another parameter the wrong command still shows up :(

Giving a hint  ;)
local s,e,prefix,cmd = data:find("%b<>%s+(%p)(%S+)|")

local s,e,prefix,cmd,everything_after_cmd = data:find("%b<>%s+(%p)(%S+)%s*(.*)%|)

Or maybe by removing the linebreak char
Title: Re: Help :(
Post by: Plagued Elohim on 18 April, 2007, 20:02:37
u forgot to pu " before ) ;) thx Naithif :D now all I need is to show that message ' Type prefix-help for list of commands available to ur profile ' to the one hand writing ... could someone help me with this one? and I promice I won't disturbe you again :P :D
Title: Re: Help :(
Post by: Naithif on 18 April, 2007, 20:05:04
My bad, you're right  :)

user:SendData

Instead of

SendToAll
Title: Re: Help :(
Post by: Plagued Elohim on 23 April, 2007, 19:33:46
thank you  :-*  ;D  :D
one small problem... can somebody remake the script so it will respond to the commands that have ' ! ' in front of them ? and not with the other like " ? @ # $ " and other. Thank you :)
Title: Re: Help :(
Post by: Madman on 23 April, 2007, 20:02:27
Code (lua) Select

local s,e,prefix,cmd,everything_after_cmd = data:find("%b<>%s+([%!])(%S+)%s*(.*)")

Done.. this only respons to cmd's with !
and if you want to add respons for + then add %+ after %! but within the [ ]
Title: Re: Help :(
Post by: Plagued Elohim on 23 April, 2007, 20:16:44
it works :D thanks :)