Raised This Month: $ Target: $400
 0% 

Ad Help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 06-03-2007 , 23:25   Ad Help
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Random Ads"
#define VERSION "1.0"
#define AUTHOR "Styles"

#define maxstuff 256
new g_adAmount 0
new filename[256]

new 
g_AdList[maxstuff]


public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
get_configsdir(filename,255)
    
format(filename,255,"%s/adlist.txt",filename)
    
register_cvar("sv_adtime""120")
    
register_clcmd("amx_reloadads""load"ADMIN_KICK"Reload ad list")
    
set_task(20.0"load")
    
set_task(get_cvar_float("sv_adtime"), "printAd"0""0"b")
    
}

public 
load()
{
    new 
readdata[128], txtlenparsedad[256]
    
g_adAmount 0
    
while(read_file(filename,g_adAmount++,readdata,127,txtlen))
    {
        
parse(filename,parsedad,sizeof(parsedad))
        
formatexg_AdList[g_adAmount], maxstuff 1parsedad )
    }
    
client_print(0print_chat"[Advertisement Mod] %i ad(s) loaded."g_adAmount)
}

public 
printAd()
{
    new 
num random_num(1g_adAmount)
    
client_print(0print_chat"%s"g_AdList[num])

This isan't working for some reason. 1) If you have 3 lines it is adding an extra. 2) Sometimes it prints out the directory of the ad instead of the actual ad. 3) Sometimes... it doesn't even print out anything.. it doesn't work.
Styles is offline
Send a message via AIM to Styles
 



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 10:33.


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