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");
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");
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
> Pressed "A"!
> Pressed "A"!
> example_boolean = true;
> example_boolean = true;
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
addbind("A");
end
or removing server binds