Raised This Month: $ Target: $400
 0% 

Advertisements - MySQL Updated 2/5/09


Post New Thread Reply   
 
Thread Tools Display Modes
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-16-2011 , 10:45   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #431

Thanks guys, hope you enjoy it. r3dw3r3w0lf i don't blame you for renaming the plugin, thats actually not a bad idea haha, I have a hard time typing plugin names, cvars, etc that have underscores in them sometimes.

Hoping I haven't introduced any new bugs. I did run into some pretty heinous problems along the way of modding the plugin that required me to do a few more things (like, make sure the server ID isn't undefined before you do an SQL LIKE SELECT with the server id as the search pattern... oh and if the game ID field in the DB has multiple games you have to "clean up" that field (replace the value with GameName) while parsing the ad or those ads won't display, this was one of the last problems I saw in testing and fixed before I posted the first .sp above). I do know there is going to be a problem with left4dead servers using this plugin loading ads that are set to run on left4dead2 servers due to the plugin not having code yet to address it. In the meantime anybody this is a problem for should be able to use the server ID's to control it. But other than that, I'll keep my fingers crossed and if anyone finds anything else wrong I'll definitely try to fix it.

The main other thing I'd really like to figure out with this plugin, something that has been a problem for some time, is the ads displaying two at a time sometimes. If it is in fact due to an additional timer being created inadvertently, maybe I can get some insight from the stock mapchooser plugin sources - I remember seeing some code in it to prevent new votes from starting if one was already in progress or something like that, could be useful example code.

I've updated the post with the attachments in it here and there also to try to clarify a few things that might have been vague or were missing altogether. Maybe I could get it to a point where the post and the README.txt file are identical.

Last edited by PharaohsPaw; 02-16-2011 at 10:49.
PharaohsPaw is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 02-16-2011 , 13:11   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #432

Once i'm done with editing the name of the plugin, i can release it and give it to you to do building off of so you don't have to keep changing names around if you want BUT i doubt you'd want too. lol

Name of the plugin: advertisements.smx
Database name: advertisements
name of the database.cfg entry: default

I do shit simple. haha
Drixevel is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-16-2011 , 15:07   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #433

its ok i'll probably stick with sm_adsmysql for now since i'm "piggybacking" on somebody else's plugin with the updates. iirc DJ Tsunami's original (standalone) plugin was named advertisements.smx

If for some reason I end up forking off a new plugin it would probably be good to change the name at that point. Maybe could call it something like adsmysql, and drop the sm_, or even just "ads".

But I don't really see forking this plugin in my future.

Last edited by PharaohsPaw; 02-16-2011 at 15:46.
PharaohsPaw is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 02-17-2011 , 01:10   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #434

alright, sounds good. I just appreciate the work on updating the plugin. I was gonna try myself but i completely fail at scripting.
Drixevel is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-17-2011 , 09:44   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #435

Updating the post with the attachments in it with full instructions etc. so we don't need a readme anymore, a little messy yet but working on it.
PharaohsPaw is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-18-2011 , 05:57   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #436

I figured out a way to fix the left4dead/left4dead2 problem without bloating the heck out of the plugin code with string coding. This will also makeit easier to add other games that substring matches would be a problem, like trying to add CS:S Beta.

Unfortunately it is going to take some further changes to both the plugin and the web interface, and editing of existing ads... but the idea is this:

Who says we have to use the game folder name (tf, cstrike, tf_beta, left4dead, left4dead2, etc.) as the game ID in the database? Continuing to do that just makes it harder to add other games that may support the core purpose of the plugin - printing ads... The plugin only needs to know the game folder name to know which ads to search for by the game type, and it doesn't ask the database what game it is running on, it asks the server. Once the plugin knows which game it is running on, it could conceivably use ANY string we tell it to use to retrieve ads defined to run on that game from the database.

Instead of always using the game folder name, for games which will present substring search problems if we use the game folder name such as left4dead2, cstrike_beta, etc. -- I can add a little code that sets a different search string for that game name.

For example, let's say it's left4dead2 ads and a left4dead server. I already know the plugin will have a problem with loading left4dead2 ads because we are doing substring searches with the SQL LIKE queries. If we changed the game name the plugin searches for to find left4dead2 ads to, say, l4d2, well, it would fix the problem because the plugin doing a substring search on left4dead would *only* find left4dead ads. Searching for left4dead would *NOT* match "l4d2". Make sense?

The same basic logic would allow adding other games like tf_beta and cstrike_beta. Just have to code the web interface game select box to use a different name for those games when adding/editing ads, and add a "name remap" for it in the plugin.

Actually, in the case of Team Fortress 2, it is probably the original game rather than the beta that would need its "ads search" name changed. Would be tricky to come up with a name for team fortress beta that doesn't have "tf" in it. I could use "teamfortbeta" or something though, so everyone's existing "tf" ads wouldn't have to be edited.

What do folks think about this? Some folks may have to edit some of their ads to re-set the game types. But it will make it easier to add other games, and not have to add an awful lot of bloat to the plugin doing special string search routines for each game like left4dead where its game folder name is a substring match for another game's.

I'm going to go ahead and start playing around with this. I'll try to figure out a way to make it as painless as possible to "upgrade" to it.

PharaohsPaw

PS: Hmm maybe I should fork this plugin. Starting to get kinda far away from its original coding in several places now. I've PM'd Strontium Dog asking for his feedback.

Last edited by PharaohsPaw; 02-18-2011 at 08:44.
PharaohsPaw is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-18-2011 , 08:51   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #437

OK heads up everyone, I'm going to use "l4d2" as the game "search" name for left4dead2 ads. The impact should be minimal since I just added left4dead2 to this plugin a few days ago and only a few people have downloaded it. To everyone, I recommend not defining any left4dead2-specific ads if you can help it, this will minimize/eliminate the amount of ad editing you'll need to do when I get this done and pushed out.

I will leave Team Fortress's name as-is (tf) so people don't have to go edit a bunch of TF2 ads, and use "teamfort2beta" or something shorter but still non-substring matching as the search name for Team Fortress 2 Beta. For counterstrike source, I'll leave the original game name as-is (cstrike) for the same reason, and use "cssbeta" as the game search name for counterstrike beta.

This may take me a little while to put together, and frankly, I may hold off releasing it until I post a separate fork of this plugin. I have some other ideas too and if I'm going to do this much work/maintenance on the plugin/interface, it might be best if I did "own" it. If for no other reason than to eliminate confusion about which attachments from which topic to use, etc etc

Cheers,
PharaohsPaw

Last edited by PharaohsPaw; 02-18-2011 at 14:08.
PharaohsPaw is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-19-2011 , 09:21   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #438

I'm planning to go ahead and "fork" this plugin. I haven't heard from Strontium Dog, but since I am definitely not trying to "steal" his work and call it all my own (I will be giving full credit to him, DJ Tsunami, and others) - and since this plugin is clearly no longer being maintained by Strontium Dog, it is time to fork it. I mean no hard feelings to Strontium Dog whatsoever, he obviously put a lot of work into it back in the days he was maintaining it and deserves respect for it.

I have considerable changes going into both the web interface and the plugin code (more than what is posted on page 43) and will be renaming the plugin, cvars, etc. when I post this plugin in the "new plugins waiting for approval" area. Not 100% sure what I'll call it yet but will probably keep it pretty short and I do need to pay attention to the rules/guidelines about defining public cvars, etc. as well.

I have finished the code changes to the web interface that display each icon an ad is set to run on, created/added icons for Counterstrike Source Beta, Team Fortress 2 Beta, and l4d2 -- and no longer need the silly isgamelisted() PHP function I wrote. I had to get a little creative with tf2beta and cssbeta icons since the ones from Valve appear to be identical to the non-beta (unless I'm just not looking hard enough), but mine do look different enough (see the blue-looking TF2-style icon in screenshot below for example) to tell them apart. Besides I have coded a hover-over text description to display the full "friendly" name of any game type icon you hover the mouse over in the ads display page (ads.php) anyway.

Here is a teaser screenshot. I left it at full 1920x(whatever) for better resolution, hopefully the forums will take it, if not I'll resize and resubmit:

EDIT: on second thought, posting such a large image really screws up the width of the forum page, etc. Posting 1024 wide one instead. (sorry!)



If folks can hang in there a little while I will be making a post in the new plugins area of the forums soon. MAYBE today! Once I have posted attachments to it I will be deleting my attachments from this thread. You will surely want to use the new version instead anyway.

Cheers,
PharaohsPaw

Last edited by PharaohsPaw; 02-19-2011 at 09:29.
PharaohsPaw is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-19-2011 , 10:41   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #439

Deleted attachments from my post on p43. Sorry. There was a spike in downloads of the .sp and the .zip, and it occurred to me that each person downloading those could be a potential person asking later why this or that from the old stuff doesn't work as described by what I post separately later... (because it has been updated a lot again...)

Just to state clearly again for the record, I will not be posting further attachments to this topic. Instead I will be posting a new, separate plugin post. As soon as it's ready I will post my final "reply" here, pointing to the new release topic/plugin in the "new plugins waiting for approval" section of the forums.

I will not leave folks hanging, there WILL be a post a bit later. I am working on "form validation" right now (making sure the input from the user in the web interface makes sense and making them fix it if it doesn't). Once that's done, the work left to do is the plugin changes to handle cases where the game folder name doesn't equal our ad "game search name" - then making final decision on what to name the plugin and its cvars. Kid's stuff.

As mentioned a few posts before, anyone using this existing (sm_adsmysql) plugin should try to avoid defining any new left4dead2 ads in the interim before I post/release my forked plugin so you don't have as many ads to edit/fix. I did preserve the original database game name for ALL other games this plugin originally supported. (remember, left4dead2 wasn't one supported by the original author.. and I can appreciate why now... haha...) As you might have figured out from the teaser screenshot above (see the one ad that has the text "left4dead2" instead of an L4D2 icon?), the new plugin and web interface aren't going to "directly" recognize ads defined that have "left4dead2" in the game field. They are going to have to be edited (but editing them will be easy).

PharaohsPaw

Last edited by PharaohsPaw; 02-19-2011 at 21:08.
PharaohsPaw is offline
PharaohsPaw
Senior Member
Join Date: Dec 2008
Old 02-21-2011 , 01:20   Re: Advertisements - MySQL Updated 2/5/09
Reply With Quote #440

Alright, I've posted it


http://forums.alliedmods.net/showthread.php?t=150731

Enjoy!
PharaohsPaw is offline
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 03:38.


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