Forum

> > CS2D > Scripts > How I make commands with parameters?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How I make commands with parameters?

2 replies
To the start Previous 1 Next To the start

old How I make commands with parameters?

foxfire
User Off Offline

Quote
Please help me guys, I'm don't understand how to make commands with parameters, for example:

!lock PlayerID

Can anyone help me?
I didnt find any topic that answers my question.

old Re: How I make commands with parameters?

Apache uwu
User Off Offline

Quote
Well this isn't very efficient but you should get the idea.

1
2
3
4
5
6
7
8
9
addhook("say","_say")

function _say(id,message)
	if string.lower(message:sub(1,7))=="!lock" then
		--lock code for player message:sub(8)
		--make sure to check if it's a number
		--and that the player exists.
	end
end

old Re: How I make commands with parameters?

foxfire
User Off Offline

Quote
user Apache uwu has written
Well this isn't very efficient but you should get the idea.

1
2
3
4
5
6
7
8
9
addhook("say","_say")

function _say(id,message)
	if string.lower(message:sub(1,7))=="!lock" then
		--lock code for player message:sub(8)
		--make sure to check if it's a number
		--and that the player exists.
	end
end


This helped me alot, finally I got it, thanks!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview