In-Game Advertisement System
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.

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.

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".

+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.)
How to make a sprite or model with your logo/advertisement
  • To change the texture of a model, you can use Jed's Half-Life Model Viewer.
    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.
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.

No comments