Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Hey guys.........
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

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

[Tutorial] How to create a command for console.

View previous topic View next topic Go down

[Tutorial] How to create a command for console.

Post by Starkkz on Fri Jun 11, 2010 3:21 pm

Okay, i'm professional for CS2D Lua Scripting..
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

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Debt on Sun Jun 13, 2010 10:29 pm

lol! 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

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Starkkz on Mon Jun 14, 2010 4:09 pm

table conversion? wtf.

Starkkz

Posts : 30
Rep : 0
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Debt on Mon Jun 14, 2010 4:40 pm

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

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Starkkz on Tue Jun 15, 2010 3:01 pm

that's not my, just posting.

Starkkz

Posts : 30
Rep : 0
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by WhiteWolf on Sat Jun 19, 2010 9:01 pm

Starkkz wrote:that's not my, just posting.
Took it off of some FPSBANANA file scripts I see.
I think that you should post a script that YOU understand pretty good.
avatar
WhiteWolf

Posts : 226
Rep : 12
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Debt on Tue Jul 06, 2010 11:35 am

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

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by WhiteWolf on Tue Jul 06, 2010 11:41 am

O.O?
avatar
WhiteWolf

Posts : 226
Rep : 12
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by V1Kt0R on Fri Jul 09, 2010 3:11 pm

so what is the use of the "parsing system"?
like what does it do
avatar
V1Kt0R

Posts : 196
Rep : 2
Join date : 2010-06-19
Age : 22
Location : Auburn

View user profile

Back to top Go down

Re: [Tutorial] How to create a command for console.

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum