Forum

> > CS2D > Scripts > need to fix a script
Forums overviewCS2D overview Scripts overviewLog in to reply

English need to fix a script

6 replies
To the start Previous 1 Next To the start

old need to fix a script

ExecL
User Off Offline

Quote
i need to fix this script can someone help me?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
if p == nil then p = {} end

--------USGN-Tables--------

p.owner = {} 
p.superadmin = {} 
p.admin = {} 
p.mod = {} 
p.member = {} 


addhook([[join]],[[thejoin]])
function thejoin(id)
if status(p.owner,id) == true then
msg("©255255255"..player(id,"name").." Joined the server")
end
if status(p.superadmin,id) == true then
msg("©255255255"..player(id,"name").." Joined the server")
end
if status(p.admin,id) == true then
msg("©255255255"..player(id,"name").." Joined the server")
end
if status(p.mod,id) == true then
msg("©255255255"..player(id,"name").." Joined the server")
end
if status(p.member,id) == true then
msg("©255255255"..player(id,"name").." Joined the server")
end
end

function status(table,id)
for _, u in ipairs(table) do
if player(id,"usgn") == u then
return true
end
end
return false
end

addhook("say","p.psay")
function p.psay(id,txt)
if txt == "!resetscore" then
parse("setscore "..id.." 0")
parse("setdeaths "..id.." 0")
msg("©041023000"..player(id,"name").." used !ResetScore")
return 1
elseif string.lower(txt) ~= "rank" then
if status(p.owner,id) then
msg("©000255255"..player(id,"name").." [Clan-Leader]: "..txt)
return 1
elseif status(p.viceowner,id) then
msg("©255000255"..player(id,"name").." [S-Admin]: "..txt)
return 1
elseif status(p.admin,id) then
msg("©255255255"..player(id,"name").." [Admin]: "..txt)
return 1
elseif status(p.mod,id) then
msg("©000000255"..player(id,"name").." [Moderator]: "..txt)
return 1
elseif status(p.member,id) then
msg("©255155000"..player(id,"name").." [Member]: "..txt)
return 1
end
end

------------------owner----------------

addhook("say,sayc")
function sayc(id, t)
if status (p.owner,id) == true and t:sub(1,5)=="!removesuperadmin" then
kid=tonumber(t:sub(7,8))
parse("removestatussuperadmin "..kid)
msg("©041023000"..player(id,"name").." used !removesuperadmin") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!removeadmin" then
kid=tonumber(t:sub(7,8))
parse("removestatusadmin "..kid)
msg("©041023000"..player(id,"name").." used !removeadmin") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!removemod" then
kid=tonumber(t:sub(7,8))
parse("removestatusmod "..kid)
msg("©041023000"..player(id,"name").." used !removemod") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!removemember" then
kid=tonumber(t:sub(7,8))
parse("removestatusmember "..kid)
msg("©041023000"..player(id,"name").." used !removemember") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!makesuperadmin" then
kid=tonumber(t:sub(7,8))
parse("statussuperadmin "..kid)
msg("©041023000"..player(id,"name").." used !makesuperadmin") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!makeadmin" then
kid=tonumber(t:sub(7,8))
parse("statusadmin "..kid)
msg("©041023000"..player(id,"name").." used !makeadmin") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!makemod" then
kid=tonumber(t:sub(7,8))
parse("statusmod "..kid)
msg("©041023000"..player(id,"name").." used !makemod") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!makemember" then
kid=tonumber(t:sub(7,8))
parse("statusmember "..kid)
msg("©041023000"..player(id,"name").." used !makemember") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!ban" then
kid=tonumber(t:sub(7,8))
parse("ban "..kid)
msg("©041023000"..player(id,"name").." used !ban") 
end 
if status (p.owner,id) == true and t:sub(1,5)=="!kick" then
kid=tonumber(t:sub(7,8))
parse("kick "..kid)
msg("©041023000"..player(id,"name").." used !kick") 
end
if status (p.owner,id) == true and t:sub(1,5)=="!makespec" then
kid=tonumber(t:sub(7,8))
parse("makespec "..kid)
msg("©041023000"..player(id,"name").." used !makespec")
end
if status (p.owner,id) == true and t:sub(1,5)=="!makect" then
kid=tonumber(t:sub(7,8))
parse("makect "..kid)
msg("©041023000"..player(id,"name").." used !makect") 
end
if status (p.owner,id) == true and t:sub(1,5)=="!maket" then
kid=tonumber(t:sub(7,8))
parse("maket "..kid)
msg("©041023000"..player(id,"name").." used !maket")
end
if status (p.owner,id) == true and t:sub(1,5)=="!banusgn" then
kid=tonumber(t:sub(7,8))
parse("banusgn "..kid)
msg("©041023000"..player(id,"name").." used !banusgn") 
end
if status (p.owner,id) == true and t:sub(1,5)=="!banip" then
kid=tonumber(t:sub(7,8))
parse("banip "..kid)
msg("©041023000"..player(id,"name").." used !banip") 
end
if status (p.owner,id) == true and t:sub(1,5)=="!banname" then
kid=tonumber(t:sub(7,8))
parse("banname "..kid)
msg("©041023000"..player(id,"name").." used !banname") 
end
if status (p.owner,id) == true and t:sub(1,5)=="!kill" then
kid=tonumber(t:sub(7,8))
parse("kill "..kid)
msg("©041023000"..player(id,"name").." used !kill")
end
end

-----------------super-admin----------------

if status (p.superadmin,id) == true and t:sub(1,5)=="!ban" then
kid=tonumber(t:sub(7,8))
parse("ban "..kid)
msg("©041023000"..player(id,"name").." used !ban") 
end 
if status (p.superadmin,id) == true and t:sub(1,5)=="!kick" then
kid=tonumber(t:sub(7,8))
parse("kick "..kid)
msg("©041023000"..player(id,"name").." used !kick") 
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!makespec" then
kid=tonumber(t:sub(7,8))
parse("makespec "..kid)
msg("©041023000"..player(id,"name").." used !makespec")
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!makect" then
kid=tonumber(t:sub(7,8))
parse("makect "..kid)
msg("©041023000"..player(id,"name").." used !makect") 
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!maket" then
kid=tonumber(t:sub(7,8))
parse("maket "..kid)
msg("©041023000"..player(id,"name").." used !maket")
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!banusgn" then
kid=tonumber(t:sub(7,8))
parse("banusgn "..kid)
msg("©041023000"..player(id,"name").." used !banusgn") 
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!banip" then
kid=tonumber(t:sub(7,8))
parse("banip "..kid)
msg("©041023000"..player(id,"name").." used !banip") 
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!banname" then
kid=tonumber(t:sub(7,8))
parse("banname "..kid)
msg("©041023000"..player(id,"name").." used !banname") 
end
if status (p.superadmin,id) == true and t:sub(1,5)=="!kill" then
kid=tonumber(t:sub(7,8))
parse("kill "..kid)
msg("©041023000"..player(id,"name").." used !kill")
end
end

------------------admin----------------

if status (p.admin,id) == true and t:sub(1,5)=="!ban" then
kid=tonumber(t:sub(7,8))
parse("ban "..kid)
msg("©041023000"..player(id,"name").." used !ban") 
end 
if status (p.admin,id) == true and t:sub(1,5)=="!kick" then
kid=tonumber(t:sub(7,8))
parse("kick "..kid)
msg("©041023000"..player(id,"name").." used !kick") 
end
if status (p.admin,id) == true and t:sub(1,5)=="!makect" then
kid=tonumber(t:sub(7,8))
parse("makect "..kid)
msg("©041023000"..player(id,"name").." used !makect") 
end
if status (p.admin,id) == true and t:sub(1,5)=="!maket" then
kid=tonumber(t:sub(7,8))
parse("maket "..kid)
msg("©041023000"..player(id,"name").." used !maket")
end
if status (p.admin,id) == true and t:sub(1,5)=="!banusgn" then
kid=tonumber(t:sub(7,8))
parse("banusgn "..kid)
msg("©041023000"..player(id,"name").." used !banusgn") 
end
if status (p.admin,id) == true and t:sub(1,5)=="!banip" then
kid=tonumber(t:sub(7,8))
parse("banip "..kid)
msg("©041023000"..player(id,"name").." used !banip") 
end
if status (p.admin,id) == true and t:sub(1,5)=="!banname" then
kid=tonumber(t:sub(7,8))
parse("banname "..kid)
msg("©041023000"..player(id,"name").." used !banname") 
end
end

------------------mod----------------

if status (p.mod,id) == true and t:sub(1,5)=="!kick" then
kid=tonumber(t:sub(7,8))
parse("kick "..kid)
msg("©041023000"..player(id,"name").." used !kick") 
end
if status (p.mod,id) == true and t:sub(1,5)=="!banname" then
kid=tonumber(t:sub(7,8))
parse("banname "..kid)
msg("©041023000"..player(id,"name").." used !banname") 
end
end
end

old Re: need to fix a script

EngiN33R
Moderator Off Offline

Quote
Code >


Greatly optimized and tabbed. You had many controversial things - checking if a superadmin was in p.viceowner when the table is actually p.superadmin and so on. Please look how I made it better and learn.

@user Kel9290: How is that supposed to help?

old Re: need to fix a script

GooDCaT
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
if p == nil then p = {} end

--------USGN-Tables--------

p.owner = {} 
p.superadmin = {} 
p.admin = {} 
p.mod = {} 
p.member = {} 


addhook([[join]],[[thejoin]])
function thejoin(id)
     if status(p.owner,id) == true then
          msg("©255255255"..player(id,"name").." Joined the server")
     end
     if status(p.superadmin,id) == true then
          msg("©255255255"..player(id,"name").." Joined the server")
     end
     if status(p.admin,id) == true then
          msg("©255255255"..player(id,"name").." Joined the server")
     end
     if status(p.mod,id) == true then
          msg("©255255255"..player(id,"name").." Joined the server")
     end
     if status(p.member,id) == true then
          msg("©255255255"..player(id,"name").." Joined the server")
     end
end

function status(table,id)
     for _, u in ipairs(table) do
          if player(id,"usgn") == usgn then
               return true
          end
     end
     return false
end

addhook("say","p.psay")
function p.psay(id,t,txt)
if t==txt then
     if txt == "!resetscore" then
          parse("setscore "..id.." 0")
          parse("setdeaths "..id.." 0")
          msg("©041023000"..player(id,"name").." used !resetScore")
          return 1
     elseif string.lower(txt) ~= "rank" then
          if status(p.owner,id) then
               msg("©000255255"..player(id,"name").." [Clan-Leader]: "..txt)
               return 1
          elseif status(p.superadmin,id) then
               msg("©255000255"..player(id,"name").." [S-Admin]: "..txt)
               return 1
          elseif status(p.admin,id) then
               msg("©255255255"..player(id,"name").." [Admin]: "..txt)
               return 1
          elseif status(p.mod,id) then
               msg("©000000255"..player(id,"name").." [Moderator]: "..txt)
               return 1
          elseif status(p.member,id) then
               msg("©255155000"..player(id,"name").." [Member]: "..txt)
               return 1
          end
     end
end

addhook("say","function")
function say(id,t,txt)
if t==txt then
     if t:sub(1,5)=="!removesuperadmin" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("removestatussuperadmin "..kid)
          msg("©041023000"..player(id,"name").." used !removesuperadmin") 
     end 
     if t:sub(1,5)=="!removeadmin" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("removestatusadmin "..kid)
          msg("©041023000"..player(id,"name").." used !removeadmin") 
     end 
     if t:sub(1,5)=="!removemod" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("removestatusmod "..kid)
          msg("©041023000"..player(id,"name").." used !removemod") 
     end 
     if t:sub(1,5)=="!removemember" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("removestatusmember "..kid)
          msg("©041023000"..player(id,"name").." used !removemember") 
     end 
     if t:sub(1,5)=="!makesuperadmin" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("statussuperadmin "..kid)
          msg("©041023000"..player(id,"name").." used !makesuperadmin") 
     end 
     if t:sub(1,5)=="!makeadmin" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("statusadmin "..kid)
          msg("©041023000"..player(id,"name").." used !makeadmin") 
     end 
     if t:sub(1,5)=="!makemod" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("statusmod "..kid)
          msg("©041023000"..player(id,"name").." used !makemod") 
     end 
     if t:sub(1,5)=="!makemember" and status(p.owner,id) then
          kid=tonumber(t:sub(7,8))
          parse("statusmember "..kid)
          msg("©041023000"..player(id,"name").." used !makemember") 
     end 
     if t:sub(1,5)=="!ban" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("ban "..kid)
          msg("©041023000"..player(id,"name").." used !ban") 
     end 
     if txt:sub(1,5)=="!kick" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id) or status(p.mod,id))then
          kid=tonumber(t:sub(7,8))
          parse("kick "..kid)
          msg("©041023000"..player(id,"name").." used !kick") 
     end
     if txt:sub(1,5)=="!makespec" and (status(p.owner,id) or status(p.superadmin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("makespec "..kid)
          msg("©041023000"..player(id,"name").." used !makespec")
     end
     if txt:sub(1,5)=="!makect" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("makect "..kid)
          msg("©041023000"..player(id,"name").." used !makect") 
     end
     if txt:sub(1,5)=="!maket" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("maket "..kid)
          msg("©041023000"..player(id,"name").." used !maket")
     end
     if txt:sub(1,5)=="!banusgn" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("banusgn "..kid)
          msg("©041023000"..player(id,"name").." used !banusgn") 
     end
     if txt:sub(1,5)=="!banip" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("banip "..kid)
          msg("©041023000"..player(id,"name").." used !banip") 
     end
     if txt:sub(1,5)=="!banname" and (status(p.owner,id) or status(p.superadmin,id) or status(p.admin,id) or status(p.mod,id)) then
          kid=tonumber(t:sub(7,8))
          parse("banname "..kid)
          msg("©041023000"..player(id,"name").." used !banname") 
     end
     if txt:sub(1,5)=="!kill" and (status(p.owner,id) or status(p.superadmin,id)) then
          kid=tonumber(t:sub(7,8))
          parse("killplayer "..kid)
          msg("©041023000"..player(id,"name").." used !kill")
end
return 1
end
end
end
untested
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview