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" |
Re: Top 10 Player HlstatsCE Announcer
difficult to say without looking at the updated source :)
but try with IsClientInGame instead of IsClientConnected |
Re: Top 10 Player HlstatsCE Announcer
I've set the "isclientingame" in it, and adjusted the strlen compare correct (was a issue) also still had 1 debug line still turned on, which is removed.
|
Re: Top 10 Player HlstatsCE Announcer
Very nice script :). Works great here, I might be being dense but is there a way to completely disable the sound file (Its not in the style of our server) as when I edit it out it still try's to download an empty path on the server. Could I suggest a cvar to make it simpler. I'll be running it with minimal noise (just chatbox text announcement) when I can figure the sound thing out. :)
|
Re: Top 10 Player HlstatsCE Announcer
Well i tried my self, but even if i do a strcmp matching "none" it will just fail one or the other, i need a correct example or something..
|
Re: Top 10 Player HlstatsCE Announcer
could this be made to work with gameME?
|
Re: Top 10 Player HlstatsCE Announcer
If you know the sql query to get the rank, it basicly could.. assuming you have also database access.
|
Re: Top 10 Player HlstatsCE Announcer
1 Attachment(s)
Quote:
|
Re: Top 10 Player HlstatsCE Announcer
Same issue, tried that too. Still loads the mp3, even though i set it to "" for the sm_top10_sound.
|
Re: Top 10 Player HlstatsCE Announcer
Quote:
Code:
if(!StrEqual(soundFileName, "none")) |
Re: Top 10 Player HlstatsCE Announcer
I tried it with equal "" (as in i put sm_top10_sound "") but for some apparent reason it still downloads the mp3...
|
Re: Top 10 Player HlstatsCE Announcer
put sm_top10_sound ""
changelevel does it still download it? (the downloads table doesn't get cleared until a map change) |
Re: Top 10 Player HlstatsCE Announcer
Well i did the change level...
[TS] Team Names: Red Blue - OnRoundEnd available: yes Host_Error: CEngineSoundServer::PrecacheSound: Bad string: Uploading dump (in-process) [proxy ''] /tmp/dumps/crash_20101013003559_1.dmp Thats kind off bad :) never made it go mad this much.. Just tried it again, changelevel.. and poef crash.. |
Re: Top 10 Player HlstatsCE Announcer
no idea about what's going on: just tried with the version i posted in #12, and no crashes or downloads are made after setting sm_top10_sound to "" and changing map.
|
Re: Top 10 Player HlstatsCE Announcer
weird, i am running the dev tree maybe thats the difference, i'll try yours again and do some extra testing on that since this should be a rocket science "issue"
|
Re: Top 10 Player HlstatsCE Announcer
If anyone can verify that post 17 indeed does not load a sound with the "sm_top10_sound" to "" (so nothing) that it does not download a file, since when i try it even though i verify it with console i still get the file send to my client.
I've placed the one from post 17 as the lead in the main page, assuming someone will stumble upon issues otherwise. For what it needs to do for me is fine now, and it seems for you too ;) |
Re: Top 10 Player HlstatsCE Announcer
Weirdly enough, now it just tries to download the sound everytime you connect prettymuch (Except for the inital first time) since the last big update.. i'll look into it, if i can find it ;)
|
Re: Top 10 Player HlstatsCE Announcer
thank for your plugin!
Can you activate sound and text only if the player connecting to the server for the first time and not at each begin of map. What 's appens if there are 2 or more top10 players on the server at the beginig of the map ? What 's appens if there are 2 or more top10 players connecting on the server at the time ? (Maybe you can add a timer to don't play the sound if a sound has already started) What 's appens if player reconnecting to the server for flood with the sound ? (maybee play sound for the player one time per map ?) good luck |
Re: Top 10 Player HlstatsCE Announcer
About the flooding, if it is a regular player... he wont be how do you say it "a noob" to misuse it. Also he doesn't here the sound and does not see the text since he is one of the top10 players.
if 2 players join at the same time it will only do the sond once as far as i have heard, the text will quickly follow up on eachother. But mostly they almost never join at the exact same time. |
Re: Top 10 Player HlstatsCE Announcer
ok thx
and for the sound at changelevel ? (if a top10 player is on the server) |
Re: Top 10 Player HlstatsCE Announcer
after changelevel it would emit the sound again. per player, assuming they dont both join at the same time (it will only be once then at that moment) if that is what you mean
|
Re: Top 10 Player HlstatsCE Announcer
I think your screenhot are too old, no "tf2..." gametypes exists as games - only "tf" for Team Fortress 2. Or are there individual making server gametypes and why?
But how can i configure the plugin in the adminoptions in hlstatsx:ce? |
Re: Top 10 Player HlstatsCE Announcer
tf = tf2, and there is no such thing to configure in hlstatsx:ce just read the instructions and follow that. That should be sufficient.
|
Re: Top 10 Player HlstatsCE Announcer
Ok, i will test it on my server.
But i wonder, why he give a screenshot from hlstats. But i think that's nothing say. It's only confusing. :mrgreen: |
Re: Top 10 Player HlstatsCE Announcer
Following error in logs
Quote:
|
Re: Top 10 Player HlstatsCE Announcer
Sound is downloading, but no sound announce, or text announce on server.
The plugin isn't work, thats pitty. |
Re: Top 10 Player HlstatsCE Announcer
Code:
L 10/04/2011 - 15:56:13: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4) |
Re: Top 10 Player HlstatsCE Announcer
Still works fine here, you created the top10 database in the databases.cfg and changed the sm_top10_game to point to the name of your install (as shown in the screenshot, which is a example) ?
|
Re: Top 10 Player HlstatsCE Announcer
Ah, I see the problem now. I entered css1 because it said so on your screenshot. But it was "css" on our hlstatsx.
I'm sorry for my stupidity. Thx! |
Re: Top 10 Player HlstatsCE Announcer
I am also getting this error and Ive dbl checked my settings
Code:
L 10/05/2011 - 17:49:02: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4) L 10/05/2011 - 17:49:02: [SM] Displaying call stack trace for plugin "top10hlxce-announce.smx": 12 months this has been waiting? |
Re: Top 10 Player HlstatsCE Announcer
The most common mistake i see normally is that the top10 database is not created and that the name of the "game" from hlstats is not correctly setup in the server.cfg. As you can see it is working for others (not only me)
As a reminder, the screenshot on the first page is a example. Since we have many games the gametype can be different too. Make sure that is correct. |
All times are GMT -4. The time now is 05:20. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.