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