| bazhenov93 |
04-17-2012 21:40 |
Need help + Request
I changed some functions on this plugin, is working has I need, but I want to add some new functions..
PHP Code:
#include <amxmodx> #include <amxmisc> #include <colorchat>
#define Plugin "GuestBook" #define Version "0.7b" #define Author "Doombringer"
#define FLAG ADMIN_ALL //#define GUESTBOOK_FILE "guestbook.htm"
#define TIMESTAMP "%B %Y - %H:%M:%S"
#define BACKGROUND_COLOR "#666666" #define TEXT_COLOR "#FFFF00"
#define MAX_LEN 132 #define ADMIN ADMIN_BAN #define VIP ADMIN_RESERVATION
new cvar, waittime, path, guestbook_name, ad_time, bool:havetowait[32], filepath[MAX_LEN];
public plugin_init() { register_plugin(Plugin, Version, Author); cvar = register_cvar("GB_enabled","1") waittime = register_cvar("GB_waittime","60") path = register_cvar("GB_savepath","") guestbook_name = register_cvar("GB_filename","guestbook.htm") ad_time = register_cvar("GB_ads_time","60") new temp[2][MAX_LEN]; get_pcvar_string(path, temp[0], MAX_LEN-1) get_pcvar_string(guestbook_name, temp[1], MAX_LEN-1) register_clcmd("gb_write", "guestbook_write1", FLAG) register_clcmd("say !gb", "guestbook_write", FLAG) register_clcmd("say /gb", "show_guestbook", FLAG) register_cvar("GB_Version", Version, FCVAR_SERVER|FCVAR_SPONLY); new configsdir[38]; get_configsdir(configsdir, 37); if(equal(temp[0], "")) formatex(filepath, MAX_LEN-1, "%s/%s", configsdir, temp[1]); else formatex(filepath, MAX_LEN-1, "%s/%s", temp[0], temp[1]);
if(!file_exists(filepath) && cstrike_running()) { new file = fopen(filepath, "at"), tempp[64]; formatex(tempp, 63,"<body bgcolor=^"%s^" text=^"%s^"><br \>^n", BACKGROUND_COLOR, TEXT_COLOR); fprintf(file, tempp, 63); fclose(file); } server_cmd("exec %s/GB_config.cfg", configsdir); set_task(float(get_pcvar_num(ad_time)), "ads"); }
public ads() { if(get_pcvar_num(cvar) < 1) return PLUGIN_CONTINUE ColorChat(0, GREY, "Write !gb to leave a message on our GuestBook!") set_task(float(get_pcvar_num(ad_time)), "ads") return PLUGIN_CONTINUE }
public can_write_again(id) havetowait[id] = false;
public guestbook_write(id, level, cid) { if ( (!cmd_access(id, level, cid, 2)) || id < 1 ) return PLUGIN_HANDLED; else if (get_pcvar_num(cvar) < 1) { client_print(id, print_console,"The plugin is disabled") return PLUGIN_HANDLED; } else if (havetowait[id]) { ColorChat(id, RED, "You have already written in the GuestBook!") ColorChat(id, RED, "Wait 30 minutes before leave a new message") return PLUGIN_HANDLED; } client_cmd(id, "messagemode gb_write"); ColorChat(id, GREEN, "Type your message or !cancel to exit") // change here }
public guestbook_write1(id, level, cid) { new file = fopen(filepath, "at"); new text[331], name[32], time[26]; new Arg[65]; read_args(Arg, 64); get_time(TIMESTAMP, time, 25); get_user_name(id, name, 31); if(cstrike_running()) formatex(text, 330,"%s %s Wrote<br \>^n%s <br \><br \>^n^n", time, name, Arg); else formatex(text, 330,"%s %s Wrote^n%s^n^n", time, name, Arg) fprintf(file, text, 330); fclose(file); ColorChat(id, GREEN, "You just wrote in the GuestBook!") havetowait[id] = true; set_task(float(get_pcvar_num(waittime)), "can_write_again", id) return PLUGIN_HANDLED }
public show_guestbook(id, level, cid) { if(!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED if(get_pcvar_num(cvar) < 1) { client_print(id, print_chat,"The plugin is disabled") return PLUGIN_CONTINUE; }
show_motd(id, filepath, "GuestBook") return PLUGIN_CONTINUE; }
The help I need:
Where "Type your message or !cancel to exit"
How to check if the player typed !cancel?
The request:
Check if player have vip/admin flag, and for all messages in motd: ADMIN in green colour before the player name
like this: (i edited the html)
http://cs301800.userapi.com/v3018008...Iblt3Qpjgo.jpg
|