Similar topics
Search
Latest topics
[Tutorial] How to create a command for console.
4 posters
Page 1 of 1
[Tutorial] How to create a command for console.
Okay, i'm professional for CS2D Lua Scripting..
I'm going to show us the Parsing System..
The Hook..
The Function..
The Command..
I'm going to show us the Parsing System..
The Hook..
- Code:
addhook("parse","parser_hook") -- We need to make the hook wich calls a function
The Function..
- Code:
addhook("parse","parser_hook")
function parser_hook(command)
end
The Command..
- Code:
function string.split(t,b)
local cmd = {}
if not b then match = "[^%s]+" else match = "[^"..b.."]+" end
for word in string.gmatch(t,match) do
table.insert(cmd,word)
end
return cmd
end
addhook("parse","parser_hook")
function parser_hook(command)
local parses = string.split(command) -- Command Splitted in table
local cmd = tostring(parses[1]) -- First Split - table[1]
if cmd == "your command name" then
-- Here you can do what you want..
return 1 -- Don't show error message
end
end
Starkkz- Posts : 30
Rep : 0
Join date : 2010-06-11
Re: [Tutorial] How to create a command for console.
Starkkz, the split command is Leegao(The true god of scripting for lua) xD and my table conversion function is like ten times better.
Debt- Posts : 10
Rep : 0
Join date : 2010-06-13
Re: [Tutorial] How to create a command for console.
table conversion? wtf.
Starkkz- Posts : 30
Rep : 0
Join date : 2010-06-11
Re: [Tutorial] How to create a command for console.
I added some stuff to Lee's epic function. I also have a question, where did you get your trig formulas?
Debt- Posts : 10
Rep : 0
Join date : 2010-06-13
Re: [Tutorial] How to create a command for console.
that's not my, just posting.
Starkkz- Posts : 30
Rep : 0
Join date : 2010-06-11
Re: [Tutorial] How to create a command for console.
Took it off of some FPSBANANA file scripts I see.Starkkz wrote:that's not my, just posting.
I think that you should post a script that YOU understand pretty good.
WhiteWolf- Posts : 226
Rep : 12
Join date : 2010-06-11
Re: [Tutorial] How to create a command for console.
I was just saying that he should explain that it isn't his, 'cause some people have tried to convince me that, and I've seen them other places, and it draws conclusion without proper facts.
Debt- Posts : 10
Rep : 0
Join date : 2010-06-13
WhiteWolf- Posts : 226
Rep : 12
Join date : 2010-06-11
Re: [Tutorial] How to create a command for console.
so what is the use of the "parsing system"?
like what does it do
like what does it do
V1Kt0R- Posts : 196
Rep : 2
Join date : 2010-06-19
Age : 29
Location : Auburn
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Fri Sep 09, 2011 4:58 pm by WhiteWolf
» Last to post wins
Fri Sep 09, 2011 4:57 pm by WhiteWolf
» COMBAT ARMS WOOOOO
Tue Oct 19, 2010 10:59 pm by viperjake31
» Its over (Bye)
Wed Sep 22, 2010 10:05 pm by Supanooba
» Sorry guys...
Wed Sep 22, 2010 10:01 pm by Supanooba
» bad feeling...
Tue Sep 21, 2010 1:16 pm by Supanooba
» This game...
Sun Sep 19, 2010 10:01 am by Supanooba
» Me, D@rk T3mpl4r, Hacking?
Sun Sep 19, 2010 12:36 am by D@rk T3mpl4r
» fractured my arm and leg
Sat Sep 18, 2010 9:08 pm by Supanooba