Results 1 to 8 of 8

Thread: Press F

  1. #1
    ... connecting
    Join Date
    Feb 2017
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Press F

    Hello, this script doesnt work. How can i make it work? It would be great to have killstreaks which activates by using button "f".
    PHP Code:
    AddStreak()
    {
        if(
    self.pers["team"] == "allies")
        {
            
    player self;
            
    killstreak player.stats["killstreak"];
            switch(
    killstreak)
            {
                case 
    3:
                    
    self playLocalSound("hattrick");
                    
    iPrintLn(player.name " ^7is on 3 killstreak!");
                    
    self iprintlnbold("^1~>^9Press F^7 to get reward);
                    if(self useButtonPressed())
                    {
                        self giveWeapon("
    frag_grenade_american_mp");
                        self setWeaponSlotAmmo( 1 );
                    }
                break;
            }
        }


  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    It's a function added via libcod, best you compile this: https://github.com/voron00/libcod

    inb4 how: https://killtube.org/showthread.php?...u-14-04-server

    EDIT: oops, usebuttonpressed is a stock function, thanks izno xD
    timescale 0.01

  3. #3
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    PHP Code:
    AddStreak() 

        if(
    self.pers["team"] == "allies"
        { 
            
    player self
            
    killstreak player.stats["killstreak"]; 
            switch(
    killstreak
            { 
                case 
    3
                    
    self playLocalSound("hattrick"); 
                    
    iPrintLn(player.name " ^7is on 3 killstreak!"); 
                    
    self iprintlnbold("^1~>^9Press F^7 to get reward"); 
                    
    self thread Nades();
                break; 
            } 
        } 
    }  
    Nades()
    {
    while(!(
    self useButtonPressed())) { wait .25;}
               
    self iprintlnbold("nades");
    self giveWeapon("frag_grenade_american_mp"); 
    self setWeaponSlotAmmo); 

    script maybe bug (one pressed - no work, better hold )
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  4. #4
    ... connecting
    Join Date
    Feb 2017
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    i changed wait to .15 and it works. thanks for help
    Last edited by t1ker; 16th April 2017 at 16:01.

  5. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    You have to be holding F while triggering this script for it to work.

    It does not wait for the player to press F, it just checks if the player, at that moment, is pressing F.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. #6
    ... connecting
    Join Date
    Feb 2017
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    so how to make it correctly ?

  7. #7
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Make a loop

  8. #8
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    You can also bind some key when player connects, to open the client command menu and execute some command.
    Might be the best libcod-free way, and will work when played presses the key you want, instead of holding it.
    set logfile 2

Posting Permissions

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