Here's a sample script whenever clients press the key "A",
Pressed "A"! message shows up.
1
2
3
4
5
6
7
8
addbind("A"); -- "sample.lua"
addhook("key","sample_key")
function sample_kety(id, key, state)
	if ( key == "A" and state == 1 ) then
	msg("Pressed \"A\"!");
	end
end
and.. we use dofile lua command to bring another script which containing another same key bind.
1
2
3
4
5
6
7
8
9
10
addbind("A"); -- another_sample.lua
example_boolean = false;
addhook("key","another_sample_key")
function another_sample_key(id, key, state)
	if ( key == "A" and state == 1 ) then
	example_boolean =true;
	end
end
and the result will be like this.
1
2
3
4
5
-- Client pressed key "A"
> Pressed "A"! -- Message
> Pressed "A"! -- Message
> example_boolean = true; -- Boolean
> example_boolean = true; -- Boolean
ye this is the problem, bringing another script which has the same key bind cause twice work reason for binding the same key for twice.
The simple way is just don't use the same key bind and consider that another script is using such key bind, but who knows?
There isn't command for check whether they are bound.
Just wishing for such commands
Check whether a key has bound
1
2
3
if not( addbind("A") ) then -- Check if this key has bound
addbind("A");
end
or removing server binds