PDA

View Full Version : Checking how sound is played at a time



Moczulak
27th October 2012, 02:44
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.

kung foo man
27th October 2012, 02:57
Sorry for deleting the last thread ^^


[03:55] Nazi'Moczulak: the point is that every shot to be monitored

So he needs something like:



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. :D

kung foo man
27th October 2012, 03:18
A really big thanks to IzNoGod, i just had to fit his anti fast-fire script :)



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;
}
}