Rocky
19th October 2013, 16: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 "";
}
{
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 "";
}