AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Advertisements Mod -- Need Help (https://forums.alliedmods.net/showthread.php?t=56031)

-=[SD]=-Turkey 06-04-2007 20:19

Advertisements Mod -- Need Help
 
Hello. This is my first plugin I've actually wrote and it compiled... It works and so does the cvar I made. What it does is I've hardcoded some advertisements into it that will display every 60 seconds (or 1 minute), I want to share this plugin with others for their tsrp servers -- I forgot to mention that I made this for TSRP. The problem is, whenever it does display the advertisements, it shows all 5 of them instead of one at a time every 60 seconds.

Here is the code:

Code:

/*
==================================================================================================================
===                                  Advertisements Mod for TSRP Servers                                      ===
====                                        Version 0.1 Alpha                                                ====
==========================================================Author: -=[SD]=-Turkey a.k.a turkey2112=================
*/
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "PLUGIN"
#define VERSION "VERSION"
#define AUTHOR "AUTHOR"
 
public plugin_init()
{
 register_plugin("Advertisements Mod", "0.1a", "turkey2112")
 register_cvar("amx_advertsenable","1")
 set_task(60.0,"advertise",0,"",0,"b")
}
public advertise()
{
 if(!get_cvar_num("amx_advertsenable")) return PLUGIN_HANDLED
 client_print(0,print_chat,"The MCPD is hiring! Apply on our forums today!") //Edit the text inside of quotes for your own adverts
 client_print(0,print_chat,"Want to save lives? Join the MCMD today! Visit our forums to apply.")
 client_print(0,print_chat,"Chase bank is looking for a new director! Do you have what it takes? Find out on our forums!")
 client_print(0,print_chat,"Need a place to stay for the night? Visit Hotel Mecklenburg! Rooms starting at only $50!")
 client_print(0,print_chat,"Good times, good drinks, good company... Come visit us at the Irish Pub!")
 return PLUGIN_HANDLED
}


Arkshine 06-04-2007 21:06

Re: Advertisements Mod -- Need Help
 
Something like :

Code:
#include <amxmodx> #include <amxmisc> new g_AdTxt[][]= {     "The MCPD is hiring! Apply on our forums today!",     "Want to save lives? Join the MCMD today! Visit our forums to apply.",     "Chase bank is looking for a new director! Do you have what it takes? Find out on our forums!",     "Need a place to stay for the night? Visit Hotel Mecklenburg! Rooms starting at only $50!",     "Good times, good drinks, good company... Come visit us at the Irish Pub!" }; new g_enabled; new g_num = 0; public plugin_init() {     register_plugin( "Advertisements Mod", "0.1a", "turkey2112");     g_enabled = register_cvar( "amx_advertsenable", "1" );         set_task( 60.0, "advertise", 0, _, _,"b" ); } public advertise() {     if( !get_pcvar_num( g_enabled ) )         return;         client_print( 0, print_chat, g_AdTxt[g_num++] );         if( g_num > sizeof g_AdTxt - 1 )            g_num = 0; }

Styles 06-04-2007 21:33

Re: Advertisements Mod -- Need Help
 
I just made/started on a nicer one. Look a few posts down ;) arkshine
fixed it up cuz im not good w/ file io yet.

-=[SD]=-Turkey 06-05-2007 06:50

Re: Advertisements Mod -- Need Help
 
Thank you very much ArkShine! I have put a special thanks to you in my .sma for when I release it here in a few. It's just a simple plugin really... no files to edit or anything.

regalis 06-05-2007 06:57

Re: Advertisements Mod -- Need Help
 
You want to release this??
I'm sure it will get unapproved in no time...
There are alot of advertising plugins out there which do a realy good job...so it's redundant!

greetz regalis

Arkshine 06-05-2007 10:58

Re: Advertisements Mod -- Need Help
 
I agree. You shouldn't release this.

-=[SD]=-Turkey 06-06-2007 06:24

Re: Advertisements Mod -- Need Help
 
I have no intentions of releasing it on the allied modders forums as I already noticed that there is a vast amount of adverts mods. :up:


All times are GMT -4. The time now is 10:35.

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