[Half-Life AMXX] / df_hook.sma Repository:
ViewVC logotype

Annotation of /df_hook.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25 - (view) (download)

1 : ian 1 /*
2 :     DF_Hook Frontend
3 : ian 25 Copyright (C) 2006-2007 Ian (Juan) Cammarata
4 : ian 1
5 : ian 25 This program is free software: you can redistribute it and/or modify
6 :     it under the terms of the GNU Affero General Public License as
7 :     published by the Free Software Foundation, either version 3 of the
8 :     License, or (at your option) any later version.
9 : ian 1
10 : ian 25 This program is distributed in the hope that it will be useful,
11 :     but WITHOUT ANY WARRANTY; without even the implied warranty of
12 :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 :     GNU Affero General Public License for more details.
14 : ian 1
15 : ian 25 You should have received a copy of the GNU Affero General Public License
16 :     along with this program. If not, see <http://www.gnu.org/licenses/>.
17 :     --------------------------------------------------------------------------------
18 :    
19 :     * http://ian.cammarata.us
20 : ian 1 * 8/16/2005 3:39:25 AM
21 :     *==============================================================================
22 :     * Change Log:
23 :     * Key (+ added | - removed | c changed | f fixed | r refactored)
24 :     * v1.0.1
25 :     * r: Execute "-hook" on client when their hook is revoked.
26 :     */
27 :     #include <amxmod>
28 :     #include <amxmisc>
29 :     new hookflag[32],toggleflag[32],custompassmsg[47]="You must finish the map before you get a hook."
30 :     public client_putinserver(id){
31 :     toggleflag[id]=0
32 :     hookflag[id]=0
33 :     new ida[1]
34 :     ida[0]=id
35 :     if(get_user_flags(id)&ADMIN_SLAY)set_task(2.0,"adminhook",0,ida,1)
36 :     return PLUGIN_CONTINUE
37 :     }
38 :     public adminhook(ida[]){
39 :     new id=ida[0]
40 :     hookflag[id]=0
41 :     server_cmd("amx_givehook #%d",get_user_userid(id))
42 :     return PLUGIN_HANDLED
43 :     }
44 :     public givehook(id,level,cid){
45 :     if(cmd_access(id,level,cid,2)){
46 :     new arg[32],player,name[32]
47 :     read_argv(1,arg,31)
48 :     player=cmd_target(id,arg,8)
49 :     if(player&&hookflag[player]==0){
50 :     get_user_name(player,name,32)
51 :     new pass[32]
52 :     get_cvar_string("df_hook_password",pass, 32)
53 :     client_cmd(player,"hook_login ^"%s^"",pass)
54 :     client_print(player,print_chat,"[AMX] : You have recieved hook privileges.")
55 :     client_print(id,print_console,"[AMX] : %s - hook privileges recieved.",name)
56 :     hookflag[player]=1
57 :     }
58 :     }
59 :     return PLUGIN_HANDLED
60 :     }
61 :     public revokehook(id,level,cid){
62 :     if(cmd_access(id,level,cid,2)){
63 :     new arg[32],player,name[32]
64 :     read_argv(1,arg,31)
65 :     player=cmd_target(id,arg,8)
66 :     if(player&&hookflag[player]==1){
67 :     get_user_name(player,name,32)
68 :     client_cmd(player,"-hook")
69 :     client_cmd(player,"hook_login ^"^"")
70 :     client_print(player,print_chat,"[AMX] : You have lost hook privileges.")
71 :     client_print(id,print_console,"[AMX] : %s - hook privileges revoked.",name)
72 :     hookflag[player]=0
73 :     }
74 :     }
75 :     return PLUGIN_HANDLED
76 :     }
77 :     public banhook(id,level,cid){
78 :     if(cmd_access(id,level,cid,2)){
79 :     new arg[32],player,name[32]
80 :     read_argv(1,arg,31)
81 :     player=cmd_target(id,arg,8)
82 :     if(player){
83 :     get_user_name(player,name,32)
84 :     client_cmd(player,"hook_login ^"^"")
85 :     client_print(player,print_chat,"[AMX] : You have been banned from using hook.")
86 :     client_print(id,print_console,"[AMX] : %s - has been banned from using hook.",name)
87 :     hookflag[player]=2
88 :     }
89 :     }
90 :     return PLUGIN_HANDLED
91 :     }
92 :     public unbanhook(id,level,cid){
93 :     if(cmd_access(id,level,cid,2)){
94 :     new arg[32],player,name[32]
95 :     read_argv(1,arg,31)
96 :     player=cmd_target(id,arg,8)
97 :     if(player&&hookflag[player]==2){
98 :     get_user_name(player,name,32)
99 :     //client_cmd(player,"hook_login ^"^"")
100 :     client_print(player,print_chat,"[AMX] : You have been unbanned for hook privileges.")
101 :     client_print(id,print_console,"[AMX] : %s - has been unbanned for hook privileges.",name)
102 :     hookflag[player]=0
103 :     }
104 :     }
105 :     return PLUGIN_HANDLED
106 :     }
107 :     public phook(id){
108 :     toggleflag[id]=1
109 :     if(!hookflag[id]){
110 :     new ida[1]
111 :     ida[0]=id
112 :     set_task(0.1,"custmsg",0,ida,1)
113 :     }
114 :     return PLUGIN_HANDLED
115 :     }
116 :     public mhook(id){
117 :     toggleflag[id]=0
118 :     return PLUGIN_CONTINUE
119 :     }
120 :     public custmsg(ida[]){
121 :     client_print(ida[0],print_center,custompassmsg)
122 :     return 1
123 :     }
124 :     public tog(id){
125 :     if(toggleflag[id])client_cmd(id, "-hook")
126 :     else{
127 :     client_cmd(id, "+hook")
128 :     if(!hookflag[id])client_cmd(id, "-hook")
129 :     }
130 :     return PLUGIN_HANDLED
131 :     }
132 :     public plugin_init(){
133 :     register_plugin("DF_Hook Frontend","1.0.1","Don Juan-jello")
134 :     register_concmd("amx_givehook","givehook",ADMIN_SLAY,"<name or #userid>")
135 :     register_concmd("amx_revokehook","revokehook",ADMIN_SLAY,"<name or #userid>")
136 :     register_concmd("amx_banhook","banhook",ADMIN_SLAY,"<name or #userid>")
137 :     register_concmd("amx_unbanhook","unbanhook",ADMIN_SLAY,"<name or #userid>")
138 :     register_clcmd("togglehook","tog",0,"- Toggle hook on and off.")
139 :     register_clcmd("+hook","phook",0)
140 :     register_clcmd("-hook","mhook",0)
141 :     return PLUGIN_CONTINUE
142 : ian 25 }

Contact
ViewVC Help
Powered by ViewVC 1.0.4