Top 10 Player HlstatsCE Announcer
1 Attachment(s)
[ALL] Top 10 Player HlstatsCE Announcer
This is my first plugin, so forgive me if i have very bad mistakes in it, someone has to learn somewhere too :) Description Basicly this plugins announces when somebody with a rank between 1 and 10 joins the servers with a nice sound and a center text message. You do need a installation of HlstatsCE for this to work ofcourse. Installation Install the smx file to your plugins folder. Add a entry to your databases.cfg Code:
"top10" Cvars [code] "sm_top10_hlstatsce_enabled", "1", "Whether this plugin should be enabled" "sm_top10_hlstatsce_game", buffer, "The shortname found after the game settings for particular servers on admin page" "sm_top10_hlstatsce_text", "2", "Default message type. 1 = Center, 2 = Hint text, 3 = Regular text. Leave empty for center" "sm_top10_hlstatsce_sounds", "addons/sourcemod/configs/top10_sounds.kv", "The config file containing the paths of sounds to play when a top10 hlstats player joins the game" I think thats it, have fun (hopefully) Changelog Code:
Version 1.0 |
Re: Top 10 Player HlstatsCE Announcer
Awesome! Please tell me it works on L4D(2)! :)
|
Re: Top 10 Player HlstatsCE Announcer
It should work with l4d(2) and css too, just added that in for gametype. It wont play a sound when it detects l4d(2) since you cant download it anyways afaik.
I've added a new cvar so you can choose where you want the message to show to people. Let me know if it works for you. |
Re: Top 10 Player HlstatsCE Announcer
I think my arena players will like it, they keep typing top10, rank... :wink:
Can you add an option to disable the sound (check if sm_top10_sound is empty and don't precache/play it)? And to improve your SM coding (and help you fix the plugin, otherwise it would be hard to get it approved), here are a few suggestions: there are many loose indentation warnings while compiling. Not a big issue, but if someone uses another editor your mixing of tabs and spaces for formatting makes things difficult to read you should use threaded queries, since the HLX db can be quite slow or on another box you should connect to the DB only once at plugin/map start (with SQL_TConnect), not parsing the databases.cfg file everytime someone joins and then establish a connection replace Code:
if(SQL_GetRowCount(hQuery) > 0) Code:
if(SQL_FetchRow(hQuery)) (both work, but I've never seen '*' :)) the -1 at the end of the query may give different results from the hlx page you might want to hook convar changes instead of calling GetConVarString inside OnMapStart. In this way the admin that changes a convar doesn't have to wait for a changelevel. the only exception is the sound, that needs to be precached, so it is fine to update it only at change level |
Re: Top 10 Player HlstatsCE Announcer
Thanks for the tips, so basicly the mixing of space and tabs will create those loose indentations? (because frankly, i dont know where they come from)
I was already looking at threaded sql for a example since it would make the server do a "hickup" on every join of a player if the database was down. You need the -1, otherwise new players (that dont exist in hlstats yet) would be counterd as the nr 1 player. The select count ('*') indeed doesn't make much sence, i was playing with it since i had some issues and since it didn't make any difference i forgot to change it back. I'll add the option to empty the sm_top10_sound. |
Re: Top 10 Player HlstatsCE Announcer
Quote:
yes, most of the times it is a problem of some lines beginning with spaces and others with tabs |
Re: Top 10 Player HlstatsCE Announcer
So i think i got the threaded part in there and fixed the loose identations, i've also did a check if the soundfile is set, if not then skip the precache (assuming it works like this? how would i tell if it work? since there is no real check?)
Also, i've added what you set with the hookconvarchange, only i dont fully understand that. I've tried to just change for instance "sm_top10_game" but it didn't change it on the fly. Dont think its 100% correct. Can you verify? |
Re: Top 10 Player HlstatsCE Announcer
Quote:
if (cvarSoundName) { with if (strlen(soundFileName) > 1) { Quote:
if (oldValue[0] == newValue[0]) { you are comparing the 1st char of the 2 strings. you should use StrEqual to compare the whole string. And sm_top10_sound should not be treated in the same way, since it will produce errors in the client and it will fail to play the sound even after the map change |
Re: Top 10 Player HlstatsCE Announcer
Ok, i'll give it another shot :) making progress at least.
p.s. isn't "if (oldValue[0] == newValue[0])" comparing the first string of a array 0? *never mind* http://wiki.alliedmods.net/Introduction_to_SourcePawn I do some perl / php sometimes and sometimes all these thing confuse eachother. |
Re: Top 10 Player HlstatsCE Announcer
I also noticed this:
L 10/09/2010 - 11:13:12: [SM] Native "EmitSound" reported: Client 2 is not connected L 10/09/2010 - 11:13:12: [SM] Displaying call stack trace for plugin "top10hlxce-announce.smx": L 10/09/2010 - 11:13:12: [SM] [0] Line 370, /home/lz/am2/orangebox/tf/addons/sourcemod/scripting/include/sdktools_sound.inc::EmitSoundToClient() L 10/09/2010 - 11:13:12: [SM] [1] Line 120, top10hlxce-announce.sp::OnClientPostAdminCheck() But i do this: if( IsClientConnected(i) && ! IsFakeClient(i)) { blabla } Why would it still "fail" |
All times are GMT -4. The time now is 07:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.