Author Topic: help  (Read 10520 times)

0 Members and 1 Guest are viewing this topic.

Offline achiever

  • Lord
  • ***
  • Posts: 260
  • Karma: +25/-22
Re: help
« Reply #25 on: 13 April, 2007, 13:10:37 »
Or do not return 1 (but then the command will show up).
yes on this the pxcommands do work but still the line
"Type prefix-help for list of commands available to ur profile"
is always shown

Anyway why don't you send it to just the user who entered the command?

well i need it to show command toevery user so the new users come to kno that these commands are present.
hi,

well ppl i have just done some scripting (well modified a completely different script ;-) )

Code: [Select]
sBot = "Fusion"
Commands = {
["myip"] = 1,
["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")
--[[elseif prefix then
SendToAll(sBot, "Did u forget to use the command")]]--
end
end
end

the comment part  is not working--> it should send message if only perfix is recieved.

well this script also keeps on sending the line
" Type prefix-help for list of commands available to ur profile "
now for the text files of ptokax even if i get to c them.
so can some 1 help me with a better solution?

achiever.
thks,
achiever.

PtokaX forum

Re: help
« Reply #25 on: 13 April, 2007, 13:10:37 »

Offline Cêñoßy†ê

  • Scripter
  • Triple Ace
  • ******
  • Posts: 190
  • Karma: +31/-3
Re: help
« Reply #26 on: 13 April, 2007, 15:44:03 »
this is how i do it
Code: Lua
  1. cmd = {}
  2. ChatArrival = function(user,data)
  3.         local data = string.sub(data,1,(string.len(data)-1))
  4.         local _,_,prefix,command = data:find("%b<>%s+(%p)(%S+)")
  5.         if command and cmd[command] then
  6.                 SendToAll(data)  -- shows command to all
  7.                 return cmd[command](user,data)
  8.         end
  9.         collectgarbage("collect")
  10. end
  11.  
  12. cmd["test"] = function(user,data)
  13.         user:SendData(frmHub:GetHubBotName(),"command 'test' received")
  14.         return 1
  15. end
« Last Edit: 13 April, 2007, 16:00:56 by C??o?y? »
***********************
Powered By Leviathan v5.2 ;)

Offline achiever

  • Lord
  • ***
  • Posts: 260
  • Karma: +25/-22
Re: help
« Reply #27 on: 13 April, 2007, 15:51:21 »
getting error
[19:12] Syntax D:\Downloads\0.3.5.1.lua5.1.1\scripts\test2.lua:34: attempt to index global 'cmd' (a nil value)
thks,
achiever.

Offline Cêñoßy†ê

  • Scripter
  • Triple Ace
  • ******
  • Posts: 190
  • Karma: +31/-3
Re: help
« Reply #28 on: 13 April, 2007, 16:01:42 »
getting error
[19:12] Syntax D:\Downloads\0.3.5.1.lua5.1.1\scripts\test2.lua:34: attempt to index global 'cmd' (a nil value)
post updated with cmd = {} in script start
***********************
Powered By Leviathan v5.2 ;)

Offline achiever

  • Lord
  • ***
  • Posts: 260
  • Karma: +25/-22
Re: help
« Reply #29 on: 14 April, 2007, 14:08:38 »
hi cenobyte,

i m abit confused,
i was trying to make a script which would send a message
"Type prefix-help for list of commands available to ur profile"
if user uses a unknown command.

the script i made up started to send the message for ptokax basic commands also, so i had to add that table.
but now still it is sending the message for the text files which i use.
so now plzz explain how should i use ur code to help solving my problem.

thks,
achiever.
thks,
achiever.

PtokaX forum

Re: help
« Reply #29 on: 14 April, 2007, 14:08:38 »