Results 1 to 6 of 6

Thread: [COD2][KNIFE SCRIPT]

  1. #1
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts

    [COD2][KNIFE SCRIPT]

    Code:
    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 "";
    }
    Last edited by Rocky; 5th December 2019 at 15:24.

  2. #2
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    I think this is from iznogod?

  3. #3
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts
    i dont think it..ask him.

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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.

  5. #5
    Private First Class
    Join Date
    Jul 2013
    Posts
    170
    Thanks
    44
    Thanked 16 Times in 11 Posts
    for it.. fs_game then it will only at that server with that bind.

  6. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    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.
    timescale 0.01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •