AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to emit sound without entity? (https://forums.alliedmods.net/showthread.php?t=127784)

Voi 05-24-2010 20:33

How to emit sound without entity?
 
Tried to find out about svc_sound, but i failed.

I want to emit a sound at position xyz, but without spawning an entity there. Help pls :)

wrecked_ 05-24-2010 20:51

Re: How to emit sound without entity?
 
emit_sound

Voi 05-24-2010 20:55

Re: How to emit sound without entity?
 
Oh really ?:)

emit_sound will not work for me cause I would need an entity there to emit it. As I said, i've got an origin and I wanted to play a sound from there without spawning additional entity to use it for emiting_sound.

To your information I would be playing sound only once in given origin.

fysiks 05-24-2010 21:00

Re: How to emit sound without entity?
 
Why can't you use an entity?

Voi 05-24-2010 21:17

Re: How to emit sound without entity?
 
Because the function itseft is already cpu intensive and I wanted to avoid spawning additional entities, cause it *may* lead to a server crash.
If thats impossible, I would just have to leave it as it is - spawning entity, emiting sound and instantly removing it.

wrecked_ 05-24-2010 23:02

Re: How to emit sound without entity?
 
The counter-strike engine can handle a ridiculous amount of function calls and operations at one time. Don't let people's whining about optimization and cpu intensity affect your opinion on the engine's capabilities.

Servers have thousands of lines of code being executed every frame on things like PreThink and constant function calls. Things like LJ stats and BlockMaker do virtually all of their (virtual) physical calculations and checks on PreThink and PostThink.

Don't worry about optimization and cpu intensity when you're creating something. Optimizations should come after you reach your objective.

Voi 05-25-2010 01:04

Re: How to emit sound without entity?
 
Ok, thanks.

ConnorMcLeod 05-25-2010 01:04

Re: How to emit sound without entity?
 
Use EngFunc_EmitAmbientSound with entity = 0

Code:

EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);

Voi 05-25-2010 01:31

Re: How to emit sound without entity?
 
Oh damn. I didnt saw there was position param there. :D

Im trying it now :P


All times are GMT -4. The time now is 05:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.