Results 1 to 3 of 3

Thread: Checking how sound is played at a time

  1. #1
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts

    Checking how sound is played at a time

    Firing weapons play a sound, I want to see what a sound with a script, I need a script because I want to call the action during playback of the sound.
    Please help me someone.

  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
    Sorry for deleting the last thread ^^

    [03:55] Nazi'Moczulak: the point is that every shot to be monitored
    So he needs something like:

    Code:
    player waittill("bullet");

    The basic idea is to monitor the ammo-count in a thread for each player (caring about changed weapons ofc).

    Gonna work on that.
    timescale 0.01

  3. #3
    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
    A really big thanks to IzNoGod, i just had to fit his anti fast-fire script

    Code:
    main()
    {    
        init_waittill_bullet(); // call this function whereever you want
    }
    
    init_waittill_bullet()
    {
        thread waitforconnect();
    }
    
    
    watchBullets()
    {
        self endon("disconnect");
        while(true)
        {
            self waittill("bullet", weaponslot);
            self iprintlnbold("Bullet: " + weaponslot);
        }
    }
    
    waitforconnect()
    {
        while(true)
        {
            level waittill("connecting",player);
            player thread waitforspawn();
            player thread watchBullets();
        }
    }
    
    waitforspawn()
    {
        self endon("disconnect");
        while(true)
        {
            self waittill("spawned_player");
            self thread onspawn();
        }
    }
    
    onspawn()
    {
        self endon("disconnect");
        self notify("start_thread");
        self endon("start_thread");
        self endon("killed_player");
        weapon=self getweaponslotweapon("primary");
        weaponb=self getweaponslotweapon("primaryb");
        ammo=self getweaponslotclipammo("primary");
        ammob=self getweaponslotclipammo("primaryb");
        while (true)
        {
            if(self getweaponslotweapon("primary")==weapon&&self getweaponslotclipammo("primary")<ammo)
                self notify("bullet", "primary");
            if(self getweaponslotweapon("primaryb")==weaponb&&self getweaponslotclipammo("primaryb")<ammob)
                self notify("bullet", "primaryb");
            weapon=self getweaponslotweapon("primary");
            weaponb=self getweaponslotweapon("primaryb");
            ammo=self getweaponslotclipammo("primary");
            ammob=self getweaponslotclipammo("primaryb");
            wait 0.05;
        }
    }
    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
  •