Raised This Month: $ Target: $400
 0% 

help wid... half-life original sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-15-2005 , 19:30   help wid... half-life original sounds
Reply With Quote #1

wich one of these is called first?
plugin_precache() or client_connect()
it sounds like it should be client_connect() but im not sure...
[ --<-@ ] Black Rose is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-15-2005 , 19:41  
Reply With Quote #2

plugin_precache is called long before client_connect. precache is called right about the time the plugin is initializing, in other words, at the start of a map. connect is called when a player connects to the server, in other words, after the map has started.
Brad is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-15-2005 , 19:55  
Reply With Quote #3

okey... this is the code...
Code:
#include <amxmodx> #define MAXSOUNDS 2 new soundlist[MAXSOUNDS][] = {"Prologue","Nightwish"} new i public precache() {     i = random_num(0,MAXSOUNDS-1)     if (i == 0) {         precache_sound("mp3/Prologue.mp3")     }     if (i == 1) {         precache_sound("mp3/Nightwish.mp3")     } } public client_connect(id) {     client_cmd(id,"mp3 play mp3/%s",soundlist[i])     return PLUGIN_CONTINUE } public plugin_init() {     register_plugin("ConnectSound","1.0","[ --<-@ ]") }
if i put this in plugin_precache()
Code:
i = random_num(0,MAXSOUNDS-1)
"i" would be assigned the same number in client_connect() that it had from plugin_precache() so it plays the same song as precached? right?


and there another way to make the plugin play the sounds when the user is dling stuff... so if i do like this...
Code:
#include <amxmodx> #define MAXSOUNDS 2 new soundlist[MAXSOUNDS][] = {"Prologue","Nightwish"} public precache() {     new i     i = random_num(0,MAXSOUNDS-1)     {         if (i == 0) {             precache_sound("mp3/Prologue.mp3")         }         if (i == 1) {             precache_sound("mp3/Nightwish.mp3")         }     }     client_cmd(id,"mp3 play mp3/%s",soundlist[i]) } public plugin_init() {     register_plugin("ConnectSound","1.0","[ --<-@ ]") }
would the user hear the sound when they are downloading? would that work?
[ --<-@ ] Black Rose is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-15-2005 , 20:59  
Reply With Quote #4

plugin_precache is called when the plugin has to load everything. It is different than the client's precaching, which I believe is what you are trying to catch. Try it on client_authorized.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-15-2005 , 21:09  
Reply With Quote #5

okaaaay
i guess like this:
Code:
#include <amxmodx> #define MAXSOUNDS 2 new soundlist[MAXSOUNDS][] = {"Prologue","Nightwish"} new i public precache() {     i = random_num(0,MAXSOUNDS-1)     if (i == 0) {         precache_sound("mp3/Prologue.mp3")     }     if (i == 1) {         precache_sound("mp3/Nightwish.mp3")     } } public plugin_init() {     register_plugin("ConnectSound","1.0","[ --<-@ ]") } public client_authorized(id) {     client_cmd(id,"mp3 play mp3/%s",soundlist[i]) }

when exactly is that called... it says "when a player has authenticated with Steam" but i dont know what that is ;P
[ --<-@ ] Black Rose is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-15-2005 , 21:17  
Reply With Quote #6

Are you trying to have players hear music when they're connecting to your server? If so, why are you reinventing the wheel? This has already been done.
Brad is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-15-2005 , 21:19  
Reply With Quote #7

Quote:
Originally Posted by Brad
Are you trying to have players hear music when they're connecting to your server? If so, why are you reinventing the wheel? This has already been done.
I'm doing this to learn...
and where has this been done?
[offtopic] is it ur daughter on the pic? [/offtopic]
[ --<-@ ] Black Rose is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-15-2005 , 22:10  
Reply With Quote #8

It looks to me that this will not work for one major reason.

variable i is assigned to the function random_num() so every time ' i ' is called so is the function, which means that there is a 50% chance that it could play a song that is not precached.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 10-15-2005 , 22:16  
Reply With Quote #9

aha... that was 1 of my questions b4 if the i has the same value as b4... well how should i fix this?
[ --<-@ ] Black Rose is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-15-2005 , 22:17  
Reply With Quote #10

Just precache both of them, then play a random song.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply


Thread Tools
Display Modes

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 23:37.


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