This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved question about precache


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dyaus
Member
Join Date: Aug 2021
Old 03-09-2022 , 08:04   question about precache
Reply With Quote #1

so i saw this in a random thread few days ago , someone said that instead of using emit_sound stocks
you can use client_cmd(index, spk ..,...) and instead of using precache_sound() you can use precache_generic() so it won't take a spot of the 512 precahce limit , my question would be , does that actually work ? like why even use emit_sound() if this method exists or is there some kind of drawback to using it i don't know about ? and will converting all my plugins to this method create some sort of error or it should work ?

i hit the 512 limit a while ago and i'm using a precache manager plugin i found by chance to save up some spots , and i'm currently rewriting the plugins i'm using to use the bare minimum of sprites/sounds it needs , so any advice on how to proceed on this would be appreciated .

Last edited by Dyaus; 03-09-2022 at 15:00.
Dyaus is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 03-09-2022 , 08:53   Re: question about precache
Reply With Quote #2

If you play client-side sounds (client_cmd(id, "spk ..." ) ) yes, you can precache them using precache_generic.
If you play server-side sounds ( emit_sound(), etc ) you need to precache them using precache_sound beccause sounds played by engine are going through pfnEmitSound and the server will crash if the sound played is not in the precache list ( same situation about models; player models could be precached by generic, because they are set within setinfo )
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-09-2022 , 14:19   Re: question about precache
Reply With Quote #3

client_cmd() plays sounds directly TO the player(s). This can be precached using precache_generic() and it won't take up a spot in the 512 limit.

emit_sound() emits a sound FROM a player to nearby players. This must be precached with precache_sound() which counts towards the 512 limit.

So the real question is which one you need in different situations. For example, you would probably want to use emit_sound() if changing the knife sounds because nearby players need to hear them coming from the knife/player itself. On the other hand, clicking a menu would play a sound to the player and only he will hear it - this is a job for client_cmd().
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Dyaus
Member
Join Date: Aug 2021
Old 03-09-2022 , 15:00   Re: question about precache
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
client_cmd() plays sounds directly TO the player(s). This can be precached using precache_generic() and it won't take up a spot in the 512 limit.

emit_sound() emits a sound FROM a player to nearby players. This must be precached with precache_sound() which counts towards the 512 limit.

So the real question is which one you need in different situations. For example, you would probably want to use emit_sound() if changing the knife sounds because nearby players need to hear them coming from the knife/player itself. On the other hand, clicking a menu would play a sound to the player and only he will hear it - this is a job for client_cmd().
hmm , makes sense , that means i will have to be very selective of what should remain as emit_sound() since i do need to free up some spots for future plugins ... anyways thanks
Dyaus is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-10-2022 , 07:54   Re: question about precache
Reply With Quote #5

For the sounds that youre not emitting using emit_sound you can merge them into one file and use spk command with its argument spk "one(s30,e50)" thats will save you alot of resources but its an annoying process to do all that.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-10-2022 at 07:54.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Dyaus
Member
Join Date: Aug 2021
Old 03-10-2022 , 11:40   Re: question about precache
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
For the sounds that youre not emitting using emit_sound you can merge them into one file and use spk command with its argument spk "one(s30,e50)" thats will save you alot of resources but its an annoying process to do all that.
o.o definitely something i want to look into in the future , a very useful piece of info , thanks for that
Dyaus is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-10-2022 , 14:24   Re: question about precache
Reply With Quote #7

Definitely not needed at all and will only make things unnecessarily complicated.
I already said that those sounds don't count towards the 512 limit, so what's the point?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:51.


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