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

In-Game Advertisement System v1.83 - 12/10/08


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose        Approver:   Emp` (115)
stupok
Veteran Member
Join Date: Feb 2006
Old 01-07-2007 , 03:50   In-Game Advertisement System v1.83 - 12/10/08
Reply With Quote #1

In-Game Advertisement System
by stupok, with many thanks to 10stars

Description
This plugin allows you to use a menu to place an entity flush with any wall, ceiling, floor, or entity. You can then modify the texture of your own model or use a fixed sprite (not rotating) or regular sprite to contain an image or advertisement. You can save ads into a .txt file. These ads will automatically load.

Installation
Download .sma, compile, put .amxx in your plugins folder. Now, restart your server so the plugin can run once. The first time it runs, it will create all of the necessary directories and files.

You won't see any items in the menu when you use +place_ad, because there are no entries in the file "precache_list.cfg" during the first run. You must add entries to this file to see them in the menu.

Instructions
Bind a key to +place_ad and hold down the key to place the entity flush with another surface. Let go of the key when the entity becomes flush with the surface. When you let go of the key, a menu will come up letting you choose a model/sprite and scale up/down the sprite.

For animated sprites, place the sprite on a wall just like any other sprite, save it, and then edit the mapname.txt to include frames and framerate.

Menu items 1-4 are precached models listed in
"mod/addons/amxmodx/configs/In-Game Ads/precache_list.cfg". Add items to the list if you'd like to see them in the menu.

If you select save, the coordinates, angles, and scale will be saved into a .txt file located in
"mod/addons/amxmodx/configs/In-Game Ads/mapname.txt".

Commands
+place_ad - hold down to place an ad flush with a wall.
iga_closer - move the ad closer to you.
iga_farther - move the ad away from you.
iga_further - move the ad away from you.
delete_ad - delete ads. This command will show a menu with all ads on the map.

Formatting Files

I would NOT suggest creating a directory and files. Just run your server with the plugin installed and the proper files and directory will be created automatically.
("mod/addons/amxmodx/configs/In-Game Ads")

Example mapname.txt file:
This is where all of the entities are saved. The plugin later reads this file to load the entities.
(Do not place more than one "thing" on one line. Model/sprite, origin, angles, scale should each have their own line.)
Code:
//this is a comment, the plugin will ignore this line
sprites/advert/bs_taco.spr
origin -1635.000000 703.000000 254.000000
angles 0.000000 90.000000 0.000000
scale 1.600000

//this is an animated sprite
sprites/advert/animation.spr
origin 907.000000 2078.000000 87.000000
angles 0.000000 990.000000 0.000000
scale 0.000000
framerate 12.0
//how many frames per second?
//framerate MUST be the last item

//this is a model
models/wall.mdl
origin -1441.000000 -8.000000 173.000000
angles 0.000000 180.000000 0.000000
Example precache_list.cfg file:
If you want to see your model or sprite in the menu, add it to this file. The plugin precaches or "loads" the entities in this file so you can view them in-game.
Code:
//If you would like to choose which model/sprite to place when placing an ad, add the item to the list below.
//For example:
//models/wall.mdl
//models/player.mdl
//etc...

models/wall.mdl
sprites/stupok69.spr
sprites/advert/stupok692.spr
How to make a sprite or model with your logo/advertisement
Model:
  • To change the texture of a model, you can use Jed's Half-Life Model Viewer.
    Detail:
    1. Open the model, select the "Texture" tab, choose the correct texture file from the list-box, select "Export".
    2. Use an image editor to change the texture. Remember, your final product will not have exactly the same colors as you want, because of the texture's original index of colors. Save the file.
    3. Open the model, select the "Texture" tab, choose the correct texture file from the list-box, select "Import", select "Save Model".
Sprite:[LIST][*]Convert a bitmap to a sprite.
Detail:
1. Make a .bmp file, preferably with width and length that are multiples of 8. Remember, the width * height must not exceed 10752.
1. Make a .bmp file, with whatever dimensions you want! Sprite Explorer gave me warnings with oddly sized sprites but they work just fine.
If the width * height of the sprite exceeds 10752, or if the width or height of the sprite is not a multiple of 8, you may encounter the error below:
Fatal Error GL_Upload16: s&3
To resolve the problem, recreate the sprite and try again. There is no definite solution that I am aware of.
2. You must save the .bmp in Indexed Mode, NOT RGB Mode. RGB will work, but the sprite will have odd colors.
3. Open a sprite creator like Sprite Explorer. Select "File>New Sprite", add your .bmp file(s), and save your sprite. To make an animated sprite just add all the frames during this step.
4. To make the sprite stop rotating, use ORIENTED rather than VP_PARALLEL.
5. To make a sprite with an invisible background, use a solid color background in your bmp and use AlphaTest when creating the sprite.

Video
NOTE: This video shows version 1.44, last updated 02/10/07.
http://video.google.com/videoplay?do...34367627736161

Credits
a1uqfk47 - Original idea

Change Log
Code:
12/10/08 - v1.83 - Now the engine handles animated sprites.

                   - Removed "frames" property, now you only define framerate.

                   - Several variables removed, more comments.

11/08/08 - v1.82 - Fixed delete bug. Previously, deleting the last entry in
                   the file would cause an infinite loop. Oops!

                   - More efficient. Prethink is only hooked while placing ad.

06/22/08 - v1.71 - Small bugfix. Thanks, connorr.

05/17/08 - v1.70 - Added ability to delete adverts in-game.

                   - Advert placement function optimized, better functionality.

                   - Added command iga_further.

                   - Cleaned up code a bit.

05/22/07 - v1.60 - Added compatibility for animated sprites. Woohoo!!

05/10/07 - v1.50 - Small adjustment in distance from wall.

05/08/07 - v1.49 - Fixed newline character error in v1.48.

05/07/07 - v1.48 - Fixed issue with Linux compatibility.

                   - Added two commands for moving the advertisement.

04/21/07 - v1.47 - Overlooked ability for other users to control ad
                   placement.

02/10/07 - v1.44 - More optimization. Switched to new file natives.

02/06/07 - v1.43 - Fixed saving incorrect sprite angles.

02/03/07 - v1.42 - More optimization, and some comments.

02/01/07 - v1.41 - Small optimization and minor changes.

01/30/07 - v1.40 - Overlooked client prethink when converting to FM.
                   Now it's fixed.

01/28/07 - v1.39 - Converted to FakeMeta for precision. Now entities will
                   be exactly flush with any wall, rather than almost flush.
                   
                   -Fixed saving incomplete filename.

                   -No more pressing menu option 2 times to flip sprite, now
                   the sprite is ALWAYS angeled correctly while placing. Move
                   toward client if sprite is invisible.

                   -Minor optimization.

01/20/07 - v1.38 - Fixed a bug, thanks Ramono :)

01/19/07 - v1.37 - More optimization.

01/18/07 - v1.36 - OPTIMIZATION!!! Hopefully more to come...

01/16/07 - v1.35 - Added MAX_MODEL_NAMELEN to prevent crashes due to
                   model's filename length.

01/16/07 - v1.34 - Odd angles during placement should be eliminated
                   completely (unless during movement from one to another
                   surface).

01/14/07 - v1.33 - More error reporting, no more wall.mdl requirement, fixed
                   saving sprites.

01/14/07 - v1.32 - Server will report error instead of crashing
                   upon failed precache.

01/13/07 - v1.31 - Fixed menu size.

01/13/07 - v1.3 - Added:
                        -New menu and menu options.
                        -Loading saved ads.
                        -Saving scale of sprites
                  Fixed:
                        -Entity having odd angles while placing.

01/07/07 - v1.2 - Changed way of placing advertisement, should be simpler.

01/07/07 - v1.1 - Slight optimization, removed unnecessary function.

01/07/07 - v1.0 - Initial release


Errors / Bugs
  • If you write entries in the mapname.txt that are not formatted correctly, the server may crash/explode and your sprites or models may spontaneously combust.
  • I recommend using sprites whose width * height does not exceed 10752 to avoid the "Fatal Error GL_Upload16: s&3" error. Please read above for more details.

v1.71 - 927 downloads
v1.82 - 251 downloads
Attached Files
File Type: sma Get Plugin or Get Source (in_game_ads.sma - 23433 views - 21.5 KB)

Last edited by stupok; 07-03-2009 at 11:59. Reason: update
stupok is offline
nick123
BANNED
Join Date: Dec 2006
Old 01-08-2007 , 00:49   Re: In-Game Advertisement Tool
Reply With Quote #2

nice
nick123 is offline
soccdoodcss
Veteran Member
Join Date: Nov 2006
Location: Wisconsin
Old 01-08-2007 , 00:58   Re: In-Game Advertisement Tool
Reply With Quote #3

Wow, sounds interesting.. definately will try.
__________________
"Now safe beneath their wisdom and their feet.
Here I will teach you truly how to sleep."
soccdoodcss is offline
Send a message via AIM to soccdoodcss
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-08-2007 , 01:12   Re: In-Game Advertisement Tool
Reply With Quote #4

Your link is all messed up..

Here: http://collective.valve-erc.com/inde...91790-06027400
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
kingzope
Member
Join Date: Sep 2005
Location: PA
Old 01-08-2007 , 15:57   Re: In-Game Advertisement Tool
Reply With Quote #5

Wow, what a great idea. Even if advertising isn't your thing, you can still put a your clan's picture in your maps to make them unique.

I'm only worried that Microsoft and Best Buy ads will start creeping into Dust and Italy. Or worse, an add for a free PS3 by filling out surveys lol.
__________________
{KHH}Counter-Strike - 205.234.209.14:27015
kingzope is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 01-08-2007 , 16:03   Re: In-Game Advertisement Tool
Reply With Quote #6

http://forums.space-headed.net/viewtopic.php?t=105

what is the difference?
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 01-08-2007 , 17:15   Re: In-Game Advertisement Tool
Reply With Quote #7

Quote:
Originally Posted by stupok69 View Post
I am talking about this one..
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
stupok
Veteran Member
Join Date: Feb 2006
Old 01-08-2007 , 17:53   Re: In-Game Advertisement Tool
Reply With Quote #8

@SweatyBanana

Thanks, fixed.

@P34nut

This is just about the same thing. You might as well use the teleport menu to save your origin and use a .bsp editor or stripper2 etc to place your ads or sprites. However, this is a nice tool for saving the exact origin and even angles for sprites or models you want to import. Watch the video for a demonstration.
stupok is offline
Charming
BANNED
Join Date: Nov 2005
Location: Canada
Old 01-08-2007 , 20:45   Re: In-Game Advertisement Tool
Reply With Quote #9

You should include instructions on how to reskin the .mdl as advertisement.
Basiclly They need JEDS HLMV save export the textures edit it make it all white, then put advertisement save dont change size when you open the texture save it as the format you exported then import the texture back in there you go advertisement :O.
Charming is offline
Send a message via ICQ to Charming Send a message via AIM to Charming Send a message via MSN to Charming Send a message via Yahoo to Charming
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-11-2007 , 10:50   Re: In-Game Advertisement Tool
Reply With Quote #10

Coordonates are saved, but no more model at map change...
Can't see any code for loading coordonates.
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 17:21.


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