PDA

View Full Version : [COD2][KNIFE SCRIPT]



Rocky
19th October 2013, 17:57
init()
{
precacheMenu("clientcmd");
thread checkplayers();
}

checkplayers()
{
while(1)
{
level waittill("connected", player);
player thread checkbash();
}
}

checkbash()
{
self endon("disconnect");
self waittill("spawned_player");

self setclientcvar("cmd", "bind SHIFT openscriptmenu ingame knifebash");
self openMenu("clientcmd");
self closeMenu("clientcmd");
while(1)
{
//wait 0.05;
self waittill("menuresponse", menu, response);
if(response != "knifebash") continue;

if(!isAlive(self)) continue;
wait 0.01;

wep = self canknife();
if(wep == "") continue;
slot = getcurrentweaponslot();
if(slot == "") continue;

self setweaponslotweapon(slot, "knife_mp");
self switchtoweapon("knife_mp");
wait 0.1;
self setclientcvar("cmd", "+melee_breath");
self openMenu("clientcmd");
self closeMenu("clientcmd");
wait 0.4;
self setclientcvar("cmd", "-melee_breath");
self openMenu("clientcmd");
self closeMenu("clientcmd");
wait 0.05;
self setweaponslotweapon(slot, wep);
self switchtoweapon(wep);
}
}

canknife()
{
wep = self getcurrentweapon();
if(wep == self getweaponslotweapon("primary") || wep == self getweaponslotweapon("primaryb")) return wep;

return "";
}

getcurrentweaponslot()
{
wep = self getcurrentweapon();
if(wep == self getweaponslotweapon("primary")) return "primary";
else if(wep == self getweaponslotweapon("primaryb")) return "primaryb";
return "";
}

Ni3ls
19th October 2013, 18:15
I think this is from iznogod?

Rocky
19th October 2013, 18:19
i dont think it..ask him.

IzNoGoD
19th October 2013, 23:07
I dont think i ever did anything with rebinding keys. I think its ugly and shouldnt be used for obvious (player disconnects and has his binds fucked up) reasons.

Rocky
20th October 2013, 11:27
for it.. fs_game then it will only at that server with that bind.

kung foo man
20th October 2013, 20:51
Well, and many ppl (like me) don't use the default keyboard layout, so binding SHIFT to anything results into unplayable server. E.g. for Afterlife Zombies I always had to rebind my keyboard layout each round, which is just annoying (and other ppl might just leave). But yea, there is no other way to hook client key bindings. :D