Error's


(~Shady~) #1

Hi all i’ve been trying to add sounds to my firstblood when i compile i got this errors:

------ Build started: Project: game, Configuration: Release Win32 ------
Compiling...
g_stats.c
.\g_stats.c(27) : warning C4013: 'trap_S_StartLocalSound' undefined; assuming extern returning int
.\g_stats.c(27) : error C2065: 'cgs' : undeclared identifier
.\g_stats.c(27) : error C2224: left of '.media' must have struct/union type
Build log was saved at "file://c:\Program Files\Wolfenstein - Enemy Territory 2.60\Twanmod\src\game\Release\BuildLog.htm"
game - 2 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

this is my g_stats.c:

if(!ent->client) {
		return;
	}
    if( g_firstblood.integer && !(g_gamestate.integer == GS_WARMUP) && !(g_gamestate.integer == GS_WARMUP_COUNTDOWN)){ 
      level.firstblood++; 
       
      if( level.firstblood == 1 ) { 
		  AP(va(" cp\"%s ^?drew first blood!
\"", ent->client->pers.netname)) ;  {
	  trap_S_StartLocalSound( cgs.media.Firstblood, CHAN_ANNOUNCER );
		  } 
		 } 
   } 

What did i do wrong :banghead:

pls help me


(kamikazee) #2

My guess is that you copied snippets from other source files and you forgot to copy the “include” statements. You should look at the part of code your copied yours from and find out where the “cgs” variable is declared.


(~Shady~) #3

Im noob at this errors… i dont know much with what you say… i just need a ******* code to get that sound working:P


(Discovery) #4

I can be wrong, but as far as i know “cgs” is only part of the client and not off the server (so it is not defined).


(Jaquboss) #5

hehe, send global sound event, you cant start a sound on a server


(~Shady~) #6

ok compiling is fine now thanx for answer my code is now:

if(!ent->client) {
		return;
	}
    if( g_firstblood.integer && !(g_gamestate.integer == GS_WARMUP) && !(g_gamestate.integer == GS_WARMUP_COUNTDOWN)){ 
      level.firstblood++; 
       
      if( level.firstblood == 1 ) { 
		  AP(va(" cp\"%s ^?drew first blood!
\"", ent->client->pers.netname)) ;  {
	  G_globalSound("sound/twanmod/firstblood.wav"); 
		  } 
		 } 
   } 

hope sound will work :stuck_out_tongue:


(~Shady~) #7

It did! thanx for all help and answers