IzNoGoD
21st December 2014, 17:10
Just stumbled upon a ridiculously simple method to read client binds using libcod.
Here is the code:
CodeCallback_PlayerCommand(args)
{
self endon("disconnect");
args = fixChatArgs(args);
output = "" + gettime() + ": ";
for (i = 0; i < args.size; i++)
output += args[i] + " ";
if(args[0] == "here_comes_the_bindtrain")
{
self.binds = [];
self.keys = [];
self.bindlist_started = true;
return;
}
if(args[0] == "bindtrain_done")
{
self.bindlist_started = false;
for(i = 0; i < self.binds.size; i++)
{
self iprintln("You got " + self.keys[i] + " binded to " + self.binds[i]);
}
return;
}
if(isdefined(self.bindlist_started) && self.bindlist_started)
{
if(args[0] == "Dumped" && args[1] == "console")
return;
self.keys[self.keys.size] = args[0];
self.binds[self.binds.size] = args[1];
return;
}
self ClientCommand();
}
and it needs to be initiated by the following line:
self execclientcmd("clear; bindlist; condump binds.cfg; here_comes_the_bindtrain; exec binds.cfg; bindtrain_done; clear");
This will iprintln all the binds the client has.
Use it for good, not for evil
Edit: vid: http://classic.xfire.com/video/6305cf
Here is the code:
CodeCallback_PlayerCommand(args)
{
self endon("disconnect");
args = fixChatArgs(args);
output = "" + gettime() + ": ";
for (i = 0; i < args.size; i++)
output += args[i] + " ";
if(args[0] == "here_comes_the_bindtrain")
{
self.binds = [];
self.keys = [];
self.bindlist_started = true;
return;
}
if(args[0] == "bindtrain_done")
{
self.bindlist_started = false;
for(i = 0; i < self.binds.size; i++)
{
self iprintln("You got " + self.keys[i] + " binded to " + self.binds[i]);
}
return;
}
if(isdefined(self.bindlist_started) && self.bindlist_started)
{
if(args[0] == "Dumped" && args[1] == "console")
return;
self.keys[self.keys.size] = args[0];
self.binds[self.binds.size] = args[1];
return;
}
self ClientCommand();
}
and it needs to be initiated by the following line:
self execclientcmd("clear; bindlist; condump binds.cfg; here_comes_the_bindtrain; exec binds.cfg; bindtrain_done; clear");
This will iprintln all the binds the client has.
Use it for good, not for evil
Edit: vid: http://classic.xfire.com/video/6305cf