Forum

> > CS2D > Scripts > How I make commands with parameters?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How I make commands with parameters?

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How I make commands with parameters?

foxfire
User Off Offline

Zitieren
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.

alt Re: How I make commands with parameters?

Apache uwu
User Off Offline

Zitieren
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

alt Re: How I make commands with parameters?

foxfire
User Off Offline

Zitieren
user Apache uwu hat geschrieben
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!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht