Raised This Month: $51 Target: $400
 12% 

quake sounds [Revamped] (Version 2.7.5 / Updated July 18, 2009)


Post New Thread Reply   
 
Thread Tools Display Modes
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 05-02-2009 , 06:32   Re: quake sounds [Revamped]
Reply With Quote #11

Quote:
Originally Posted by Grrrrrrrrrrrrrrrrrrr View Post
The problem with your code is that it compiles with code for every mod and runs repetitive if statements. I know there is a default define called build_dod, but I don't know what the default define is for other mods. This would be that same as your code but with define statements since the define is set by sourcemod.
This is a normal practice to include such "if" statements into the plugin. Such code will use maybe ~0.000000000000001% more CPU's resources then your code but it will be MUCH simpler for the server adminstrator to install. Only ~10% of all sourcemod admins know how to recompile plugins and only ~5% will do this AFAIK.
If you want to optimize your plugin you can use the integer variable to store current game name, for example:
PHP Code:
#define GAME_ANY 0
#define GAME_CS 1
#define GAME_TF 2
#define GAME_HL 3
#define GAME_DOD 4

new g_GameName 0;

// OnPluginStart:
decl String:gameName[30]; 
GetGameFolderName(gameNamesizeof(gameName)); 
     
if (
StrEqual(gameName"cstrike")) 

    
g_GameName GAME_CS;

else if (
StrEqual(gameName"dod")) 

    
g_GameName GAME_DOD;

else if (
StrEqual(gameName"tf")) 

    
g_GameName GAME_TF;

else if (
StrEqual(gameName"hl2mp")) 

    
g_GameName GAME_HL;

else 

   
g_GameName GAME_ANY;


// Somewhere in the code where you are using game specific functions:
if (g_GameName == GAME_CS

    
// do CS stuff here

else if (
g_GameName == GAME_DOD

   
// do DoD stuff here

else 
// ...  etc. 
p.s. "build_dod"??
__________________
For admins: My plugins

For developers: Colors library

Last edited by exvel; 05-02-2009 at 07:39.
exvel is offline
Send a message via ICQ to exvel
psychonic

BAFFLED
Join Date: May 2008
Old 05-02-2009 , 09:44   Re: quake sounds [Revamped]
Reply With Quote #12

Quote:
Originally Posted by Sgt-Mess View Post
head shots don't play at all for me.
Grrrrrrrrrrrrrrrrrrr,

To hook DOD:S headshots, you have to use the player_hurt event.
PHP Code:
new bool:headshot = (GetEventInt(event"health") <= && GetEventInt(event"hitgroup") == 1); 

Last edited by psychonic; 05-02-2009 at 14:06.
psychonic is offline
Grrrrrrrrrrrrrrrrrrr
Senior Member
Join Date: Oct 2007
Old 05-02-2009 , 14:01   Re: quake sounds [Revamped]
Reply With Quote #13

@exvel: When I started working on superhero mod source from Anthony's code, I saw that he used BUILD_DOD without defining it in his code. So, I assumed that sourcemod auto detected the mod and defined BUILD_DOD. (Take a look at http://users.svn.alliedmods.net/view...ce&view=markup) So, if I'm right, what would the define be for css, tf2, and so forth? (Thanks for the help)

@psychonic: Thank you, I added your code in. Now, someone just needs to test the new code with DOD since I don't have DOD. (Sgt-Mess probably will test the code)
__________________
Note: "r" letters = 19 ; CHEESE: I LIKE CHOCOLATE MILK

Last edited by Grrrrrrrrrrrrrrrrrrr; 05-02-2009 at 14:11.
Grrrrrrrrrrrrrrrrrrr is offline
Send a message via AIM to Grrrrrrrrrrrrrrrrrrr
Sgt-Mess
Senior Member
Join Date: Dec 2007
Location: Sway Side,WA
Old 05-02-2009 , 16:05   Re: quake sounds [Revamped]
Reply With Quote #14

I've got all the sounds set to play to everyone while testing and the only sounds that played back where "Combowhore, MultiKill, & FirstBlood"

This is all I saw in the logs.

Code:
L 05/02/2009 - 15:58:05: [SM] Plugin encountered error 15: Array index is out of bounds
L 05/02/2009 - 15:58:05: [SM] Displaying call stack trace for plugin "quakesounds.smx":
L 05/02/2009 - 15:58:05: [SM]   [0]  Line 467, /home/groups/sourcemod/upload_tmp/php50Qb4Z.sp::EventPlayerDeath()
__________________
Sgt-Mess is offline
Send a message via AIM to Sgt-Mess
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 05-02-2009 , 16:26   Re: quake sounds [Revamped]
Reply With Quote #15

Grrrrrrrrrrrrrrrrrrr, I think it is something like debug definitions for DoD functionality that were planed to add in the future so Anthony put DoD's code into #if statement. So BUILD_DOD isn't a sourcemod definition I think. Of course I can be wrong.
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
Sgt-Mess
Senior Member
Join Date: Dec 2007
Location: Sway Side,WA
Old 05-02-2009 , 21:50   Re: quake sounds [Revamped]
Reply With Quote #16

Works great now thanks.
__________________
Sgt-Mess is offline
Send a message via AIM to Sgt-Mess
PStar
Veteran Member
Join Date: Mar 2008
Old 05-03-2009 , 15:46   Re: quake sounds [Revamped] (Version 2.00 / Updated May 2 2009)
Reply With Quote #17

How about making an Sp file for each supported mod in the first post?

Like:
sm_quakesound_css.sp
sm_quakesound_dod.sp
.
.
.
And so on... It wouldn't mess up the post infact it would make it easier to choose for server admins.
PStar is offline
Sgt-Mess
Senior Member
Join Date: Dec 2007
Location: Sway Side,WA
Old 05-03-2009 , 17:55   Re: quake sounds [Revamped] (Version 2.00 / Updated May 2 2009)
Reply With Quote #18

I think sounds under "killsound" should be the highest priority then all the other sounds cause if you got one more kill to go and get a knife, it will play humilation instead of "GodLike" or if you get two kills and only need one to get "GodLike" it will play multikill.

Also for css "HeadShot" still doesn't seem to be working I got the config set to "2"
__________________
Sgt-Mess is offline
Send a message via AIM to Sgt-Mess
Xp3r7
SourceMod Donor
Join Date: Jul 2006
Old 05-04-2009 , 10:04   Re: quake sounds [Revamped] (Version 2.00 / Updated May 2 2009)
Reply With Quote #19

What version of SM do you need for this?

I have SM 1.1.
__________________
Xp3r7 is offline
Send a message via MSN to Xp3r7
Grrrrrrrrrrrrrrrrrrr
Senior Member
Join Date: Oct 2007
Old 05-04-2009 , 12:49   Re: quake sounds [Revamped] (Version 2.00 / Updated May 2 2009)
Reply With Quote #20

The event priority list from highest to lowest priority:
  1. First blood
  2. Combo kills
  3. kills
  4. head shots
  5. grenades
  6. knife
@Sgt-Mess: Please attach your configuration file so I can see if there are any problems with it. Also, If you want the kills (killsound) to be first, I will change that for you.

@Xp3r7: Sourcemod 1.2 is the minimum requirement

@exvel: for now, I did what PStar suggested. But, I will use your code for my other plug-ins. thank you for the help.
__________________
Note: "r" letters = 19 ; CHEESE: I LIKE CHOCOLATE MILK

Last edited by Grrrrrrrrrrrrrrrrrrr; 05-04-2009 at 16:44.
Grrrrrrrrrrrrrrrrrrr is offline
Send a message via AIM to Grrrrrrrrrrrrrrrrrrr
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 15:22.


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