Raised This Month: $ Target: $400
 0% 

If this Plugin's code is uptodate to 1.71


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 05-23-2006 , 20:04   If this Plugin's code is uptodate to 1.71
Reply With Quote #1

http://forums.alliedmods.net/showthread.php?p=138226

Just a simple yes or no would be nice
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-23-2006 , 20:16  
Reply With Quote #2

Is it not working? I ran some optimizations on it, but for some reason it won't compile with fputs for me so I can't test it.

Code:
/* PUBLIC SERVER RULES 1.20 ( 2005-08-18 ) Plugin by Priski Usage : Put rules in rules.txt file in cstrike folder and set rules_speed and rules_interval whatever you like Commands : rules_show   - shows rules listed in rules.txt rules_enable     - set this to 0 to disable automatic rules display say /rules   - displays rules to normal user CVARS : rules_interval      - interval between automatic rules display rules_admin_only    - disables say /rules command from regular users rules_join      - if set 1 displays rules after player have joined server rules_hudmessage_time   - time how long hudmessage is displayed rules_join_timeout  - delay to show rules when joining to the server Changelog : 1.20 / 2005-08-18 - removed client chat rules - fixed major bugs 1.11 / 2005-08-15 - fixed some bugs 1.10 / 2005-08-14 - new CVARs : rules_hudmessage, rules_hudmessage_time rules_join_timeout - Rules in hudmessage mode also 1.03 / 2005-08-12 - rules_enable command fix. - new CVAR "rules_join" set 1 to show rules to players when they join server 1.02 / 2005-08-11 - optimized code - rules_enable is now a command - default interval is now 10 minutes 1.01 / 2005-08-11 - added rules_admin_only & say /rules command - variables are global now 1.0 / 2005-08-11 - first release */ #include <amxmodx> #include <amxmisc> new base[] = "rules.txt" new i, num, text[127], hudmsg[440] //max hudmessage length was 439 chars (?) new g_pAdminOnly new g_pJoin new g_pJoinTimeout new g_pHudMessageTime new g_pInterval public plugin_init() {         register_plugin("AMXX Public server rules", "1.20", "Priski")         // register command         register_concmd("rules_show", "rules", ADMIN_KICK, "- show rules to everybody")     register_concmd("rules_enable", "r_enable", ADMIN_KICK, "- <1|0> set automessagin on/off")     g_pAdminOnly = register_cvar("rules_admin_only", "0")     g_pJoin = register_cvar("rules_join", "1")     g_pJoinTimeout = register_cvar("rules_join_timeout", "5")     g_pHudMessageTime = register_cvar("rules_hudmessage_time", "10")     g_pInterval = register_cvar("rules_interval", "600")     register_clcmd("say /rules", "clientrules", ADMIN_ALL, "- show rules") } public plugin_cfg() {     new iFile = fopen(base,"wt")     if (iFile) {         fputs(iFile, "; This is the public rules file, put your rules below")         fputs(iFile, "; Remember, max amount of characters is 439")         console_print(0, "%s file not found. creating new ...", base)     }     } public client_authorized ( id ) {     // on join display rules         if (get_pcvar_num(g_pJoin)) {         new tmp[1]         tmp[0] = id         set_task(1.0, "showrules",id,tmp,1)         console_print(0, "[user %d] client auth!", tmp[0])     }         return PLUGIN_HANDLED } public showrules (pid[]) {     new id = pid[0]         if ( get_user_team(id) != 1 && get_user_team(id) != 2 ) {         if (id) {             new tmp[1]             tmp[0] = id             set_task(2.0, "showrules",id,tmp,1)  // not yet in server             console_print(0, "[user %d] wait for joining team ...", id)         }         return PLUGIN_HANDLED     }         new tmp[1]     tmp[0] = id         console_print(0, "[user %d] joined team : %d", id, get_user_team(id))     console_print(0, "[user %d] printing rules after %d seconds", id, get_pcvar_num(g_pJoinTimeout))         set_task(get_pcvar_num(g_pJoinTimeout), "printrules", id, tmp, 1)  // not yet in server         return PLUGIN_HANDLED } public printrules(pid[]) {     new id = pid[0]     console_print(0, "[user] printing rules for user %d", id)             set_hudmessage ( 200, 150, 0, 0.02, 0.25, 2, 0.1, get_pcvar_float(g_pHudMessageTime), 0.05, 1.0, 1)     format(hudmsg, 439, "")             new iFile = fopen(base,"rt")         if(!iFile)         return PLUGIN_CONTINUE             // read all the rules     while(!feof(iFile))     {         fgets(iFile,text,126)         add(hudmsg,439,text)         add(hudmsg,439,"^n")                 }             // show hudmessages     show_hudmessage(id, hudmsg)         return PLUGIN_HANDLED } public r_enable(id, level, cid) {     if (!cmd_access(id, level, cid, 0)) {  // NOT ADMIN         return PLUGIN_HANDLED     }         new arg[3]         read_argv(1, arg, 2)     new value = str_to_num(arg)         if (!isalnum(arg[0]))         value = -1         if (value == 0) {                 if (task_exists(2)) // close task             remove_task(2)                  console_print(id, "You have disabled automatic messages")         return PLUGIN_HANDLED             }     if (value == 1) {         // activate task, reload if already exist         if (task_exists(2)) {             change_task(2, get_pcvar_float(g_pInterval))             } else {             set_task(get_pcvar_float(g_pInterval), "rules", 2, "", 0, "b")         }           console_print(id, "You have enabled automatic messages")         return PLUGIN_HANDLED           }     if (task_exists(2)) {         console_print(id, "automessages is ON.")         } else {         console_print(id, "automessages is OFF.")     }     console_print(id, "rules_enable <1|0> (1 = ON, 0 = OFF)")     return PLUGIN_HANDLED           } public clientrules(id, level, cid) {     new pID[1]     pID[0] = id         console_print(0,"[user %d]Print rules for me only",pID[0])     printrules(pID[0]) } public rules(id, level, cid) {     new pID[1]     pID[0] = id                 if (!cmd_access(id, level, cid, 0)) {  // NOT ADMIN         return PLUGIN_HANDLED     }         // read file to all users     pID[0] = 0     console_print(0,"[user %d]Print rules for all",id)     printrules(pID[0])         // Reset scheduled task after display     if (get_pcvar_float(g_pInterval) > 0) {         if (task_exists(2)) {             change_task(2, get_pcvar_float(g_pInterval))             } else {             set_task(get_pcvar_float(g_pInterval), "rules", 200, "", 0, "b")         }     }         return PLUGIN_HANDLED }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 05-23-2006 , 20:19  
Reply With Quote #3

not so much as it is not working, but i am using it as the the simplest form to learn read_file commands so to speak. I need to get my plugins to read ini files.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-23-2006 , 20:21  
Reply With Quote #4

Quote:
Originally Posted by allenwr
not so much as it is not working, but i am using it as the the simplest form to learn read_file commands so to speak. I need to get my plugins to read ini files.
Well, I converted that to use pcvars and the new file natives. It's untested so I can't be sure if it works though.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 05-23-2006 , 20:24  
Reply With Quote #5

you have aim yes? i think i have you on my friends list...
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Reply



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


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