Forum

> > CS2D > Scripts > admin script repaire
Forums overviewCS2D overview Scripts overviewLog in to reply

English admin script repaire

3 replies
To the start Previous 1 Next To the start

old admin script repaire

_Ultimate_
User Off Offline

Quote
Can someone repair for me that 500 lined script it has some errors... here are list of some errors i found

1.In this script they are multiple ranks like VIP MEMBER MODERATOR and ADMIN.So if i example put my usgn in the admin rank i enter in the server and i type @say YO it will work but if you enter and you usgn is nowhere and to you type example @say hi

it will appear this

NAME (VIP) : hi
NAME (Moderator) : hi
NAME (Member) : hi

can someone just repair the script a little

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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = { Rank = {} }
btimer={}
for i=1,32 do
btimer[i]=0
end


addhook("say","AdminSay")
addhook("second", "startsec")

function NewAdmin(USGN,COLOR,RANK)
AdminTable[USGN] = { C = COLOR, R = RANK}
local A = AdminTable[USGN]
end

function AdminSay(P,T)
if string.sub(T, 1, 5)=="@say " then
local A = AdminTable[player(P,"usgn")]
	if A then
		tmpstr=string.sub(T, 6)
			msg(Color(255, 0, 0), player(P, "name").." (Server Admin): "..tmpstr)
			return 1
	end
elseif string.sub(T, 1, 6)=="@kick " then
local A = AdminTable[player(P, "usgn")]
	if A then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				msg(Color(0, 0, 0), player(P, "name").." KICKED "..player(tmpid, "name")..".")
				parse("kick "..tmpid)
				return 1
			else
				msg2(T, Color(255, 0, 0), "Player does not exist!")
				return 1
			end
	end
elseif string.sub(T, 1, 5)=="@ban " then
local A = AdminTable[player(P,"usgn")]
	if A then
		tmpid=string.sub(T, 6)
			if player(tmpid, "exists") then
				msg(Color(0, 0, 0), player(P, "name").." BANNED "..player(tmpid, "name")..".")
				parse("banip "..tmpid)
				parse("banusgn "..tmpid)
				return 1
			else
			msg2(T, Color(255, 0, 0), "Player does not exist!")
			return 1
			end
	end
elseif string.sub(T, 1, 6)=="@slap " then
local A = AdminTable[player(P,"usgn")]
	if A then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				if player(tmpid, "health") > 0 then
					msg(Color(0, 0, 0), player(P, "name").." SLAPPED "..player(tmpid, "name")..".")
					parse("slap "..tmpid)
				else
					msg2(P, Color(255, 0, 0), "Player is already dead!")
					return 1
				end
			
			end
	else
	msg2(P, Color(255, 0, 0), "Access Denied!")
	return 1
	end
elseif string.sub(T, 1, 5)=="@kill " then
local A = AdminTable[player(P,"usgn")]
	if A then
		tmpid=string.sub(T, 6)
			if player(tmpid, "exists") then
				if player(tmpid, "health") > 0 then
					msg(Color(0, 0, 0), player(P, "name").." KILLED "..player(tmpid, "name")..".")
					parse("deathslap "..tmpid)
				else
					msg2(P, Color(255, 0, 0), "Player is already dead!")
					return 1
				end
			else
			msg2(P, Color(255, 0, 0), "Player does not exist!")
			return 1
			end
	end
end
end

function startsec()
for i=1,32 do
if not btimer[i]==0 then
btimer[i]=btimer[1]-1
end
end
end

NewAdmin(38512,"Red","Admin Helper")
NewAdmin(30195,"Red","Admin Helper")
NewAdmin(17531,"Red","Admin Helper")
NewAdmin(16661,"Red","Admin Helper")
NewAdmin(32810,"Red","Admin Helper")

addhook("startround","startR")
addhook("kill","startkill")

function digits(n, p, m)
     if not m then m = 10^p - 1 end
     if n == 0 then return "000" end
     if n <= m then
          local _p = 0
          while (n < 10^(p-1)) do
               p = p-1
               _p = _p + 1
          end
          local str = n
          for i = 1, _p, 1 do
               str = "0"..str
          end
          return str
     else
          return m
     end
end

function Color(r, b, g)

     return string.format("©%s%s%s", digits(r, 3, 255), digits(b, 3, 255),digits(g, 3, 255))
end


_msg = msg
function msg(t1, t2, b)
     local centered = ""
     local color = ""
     local text = ""
     if t2 then
          color = t1
          text = t2
     else
          color = ""
          text = t1
     end

     if b then
          centered = "@C"
     end
     return _msg(color..text..centered)
end

say = msg

_msg2 = msg2
function msg2(p, t1, t2, b)

     local centered = ""
     local color = ""
     local text = ""
     if t2 then
           color = t1
           text = t2
     else
           color = ""
           text = t1
     end

     if b then
          centered = "@C"
     end
     print(string.format("%sSayTo(%s:ID#\'%s\'): %s", color, player(p,"name"), p, text))
     return _msg2(p, color..text..centered)
end
sayto = msg2

level={}
for i =1,32 do
level[i]=0
end

function StartR()
	parse("sv_sound \"fun/prepare.wav\"")
	fblood=0
end

function startkill(killer,victim,weapon)
level[victim]=0
level[killer]=level[killer]+1

if player(killer, "team")==1 then
	if (fblood==0) then
		fblood=1
		parse("sv_sound \"fun/firstblood.wav\"");
		msg (Color(255, 0, 0), player(killer,"name").." sheds FIRST BLOOD by killing "..player(victim,"name").."!", true)
	end
	-- HUMILIATION? (KNIFEKILL)
	if (weapon==50) then
		-- HUMILIATION!
		parse("sv_sound \"fun/humiliation.wav\""); 
		msg (Color(255, 0, 0), player(killer,"name").." humiliated "..player(victim,"name").."!", true)
	else
		-- REGULAR KILL
		if (level[killer]==1) then
			-- Single Kill! Nothing Special!
		elseif (level[killer]==2) then
			parse("sv_sound \"fun/doublekill.wav\"");
			msg (Color(255, 0, 0), player(killer,"name").." made a Doublekill!", true)
		elseif (level[killer]==3) then
			parse("sv_sound \"fun/multikill.wav\"")
			msg (Color(255, 0, 0), player(killer,"name").." made a Multikill!", true)
		elseif (level[killer]==4) then
			parse("sv_sound \"fun/ultrakill.wav\"")
			msg (Color(255, 0, 0), player(killer,"name").." made an ULTRAKILL!", true)
		elseif (level[killer]==5) then
			parse("sv_sound \"fun/monsterkill.wav\"")
			msg (Color(255, 0, 0), player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!", true)
		else
			parse("sv_sound \"fun/unstoppable.wav\"")
			msg (Color(255, 0, 0), player(killer,"name").." is UNSTOPPABLE! "..level[killer].." KILLS!", true)
		end
	end

else
	if (fblood==0) then
		fblood=1
		parse("sv_sound \"fun/firstblood.wav\"");
		msg (Color(0, 0, 255), player(killer,"name").." sheds FIRST BLOOD by killing "..player(victim,"name").."!", true)
	end
	if (weapon==50) then
		parse("sv_sound \"fun/humiliation.wav\""); 
		msg (Color(0, 0, 255), player(killer,"name").." humiliated "..player(victim,"name").."!", true)
	else
		-- REGULAR KILL
		if (level[killer]==1) then
			-- Single Kill! Nothing Special!
		elseif (level[killer]==2) then
			parse("sv_sound \"fun/doublekill.wav\"");
			msg (Color(0, 0, 255), player(killer,"name").." made a Doublekill!", true)
		elseif (level[killer]==3) then
			parse("sv_sound \"fun/multikill.wav\"")
			msg (Color(0, 0, 255), player(killer,"name").." made a Multikill!", true)
		elseif (level[killer]==4) then
			parse("sv_sound \"fun/ultrakill.wav\"")
			msg (Color(0, 0, 255), player(killer,"name").." made an ULTRAKILL!", true)
		elseif (level[killer]==5) then
			parse("sv_sound \"fun/monsterkill.wav\"")
			msg (Color(0, 0, 255), player(killer,"name").." made a MO-O-O-O-ONSTERKILL-ILL-ILL!", true)
		else
			parse("sv_sound \"fun/unstoppable.wav\"")
			msg (Color(0, 0, 255), player(killer,"name").." is UNSTOPPABLE! "..level[killer].." KILLS!", true)
		end
	end
end
end

Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
VipTable = { Rank = {} }
btimer={}
for i=1,32 do
btimer[i]=0
end


addhook("say","VipSay")
addhook("second", "startsec")

function NewVip(USGN,COLOR,RANK)
VipTable[USGN] = { C = COLOR, R = RANK}
local A = VipTable[USGN]
end

function VipSay(P,T)
if string.sub(T, 1, 5)=="@say " then
local A = VipTable[player(P,"usgn")]
	if A then
		tmpstr=string.sub(T, 6)
			msg(Color(255, 255, 0), player(P, "name").." (VIP): "..tmpstr)
			return 1
	end
end
end

NewVip(27706,"Red","Admin Helper")
NewVip(010101,"Red","Admin Helper")

Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
MemberTable = { Rank = {} }
btimer={}
for i=1,32 do
btimer[i]=0
end


addhook("say","MemberSay")
addhook("second", "startsec")

function NewMember(USGN,COLOR,RANK)
MemberTable[USGN] = { C = COLOR, R = RANK}
local U = MemberTable[USGN]
end

function MemberSay(P,T)
if string.sub(T, 1, 5)=="@say " then
local U = MemberTable[player(P,"usgn")]
	if U then
		tmpstr=string.sub(T, 6)
			msg(Color(0, 0, 255), player(P, "name").." (Member): "..tmpstr)
			return 1
	end
elseif string.sub(T, 1, 6)=="@kick " then
local U = MemberTable[player(P, "usgn")]
	if U then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				msg(Color(0, 0, 0), player(P, "name").." KICKED "..player(tmpid, "name")..".")
				parse("kick "..tmpid)
				return 1
			else
				msg2(T, Color(255, 0, 0), "Player does not exist!")
				return 1
			end
	end

elseif string.sub(T, 1, 6)=="@slap " then
local U = MemberTable[player(P,"usgn")]
	if U then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				if player(tmpid, "health") > 0 then
					msg(Color(0, 0, 0), player(P, "name").." SLAPPED "..player(tmpid, "name")..".")
					parse("slap "..tmpid)
				else
					msg2(P, Color(255, 0, 0), "Player is already dead!")
					return 1
				end
			
			end
	else
	msg2(P, Color(255, 0, 0), "Access Denied!")
	return 1
	end
end
end


function startsec()
for i=1,32 do
if not btimer[i]==0 then
btimer[i]=btimer[1]-1
end
end
end

NewMember(18906,"Red","Admin Helper")
NewMember(010101,"Red","Admin Helper")

Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
ModTable = { Rank = {} }
btimer={}
for i=1,32 do
btimer[i]=0
end


addhook("say","ModSay")
addhook("second", "startsec")

function NewMod(USGN,COLOR,RANK)
ModTable[USGN] = { C = COLOR, R = RANK}
local M = ModTable[USGN]
end

function ModSay(P,T)
if string.sub(T, 1, 5)=="@say " then
local M = ModTable[player(P,"usgn")]
	if M then
		tmpstr=string.sub(T, 6)
			msg(Color(0, 255, 0), player(P, "name").." (Moderator): "..tmpstr)
			return 1
	end
elseif string.sub(T, 1, 6)=="@kick " then
local M = ModTable[player(P, "usgn")]
	if M then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				msg(Color(0, 0, 0), player(P, "name").." KICKED "..player(tmpid, "name")..".")
				parse("kick "..tmpid)
				return 1
			else
				msg2(T, Color(255, 0, 0), "Player does not exist!")
				return 1
			end
	end
elseif string.sub(T, 1, 5)=="@ban " then
local M = ModTable[player(P,"usgn")]
	if M then
		tmpid=string.sub(T, 6)
			if player(tmpid, "exists") then
				msg(Color(0, 0, 0), player(P, "name").." BANNED "..player(tmpid, "name")..".")
				parse("banip "..tmpid)
				parse("banusgn "..tmpid)
				return 1
			else
			msg2(T, Color(255, 0, 0), "Player does not exist!")
			return 1
			end
	end
elseif string.sub(T, 1, 6)=="@slap " then
local M = ModTable[player(P,"usgn")]
	if M then
		tmpid=string.sub(T, 7)
			if player(tmpid, "exists") then
				if player(tmpid, "health") > 0 then
					msg(Color(0, 0, 0), player(P, "name").." SLAPPED "..player(tmpid, "name")..".")
					parse("slap "..tmpid)
				else
					msg2(P, Color(255, 0, 0), "Player is already dead!")
					return 1
				end
			
			end
	else
	msg2(P, Color(255, 0, 0), "Access Denied!")
	return 1
	end
elseif string.sub(T, 1, 5)=="@kill " then
local M = ModTable[player(P,"usgn")]
	if M then
		tmpid=string.sub(T, 6)
			if player(tmpid, "exists") then
				if player(tmpid, "health") > 0 then
					msg(Color(0, 0, 0), player(P, "name").." KILLED "..player(tmpid, "name")..".")
					parse("deathslap "..tmpid)
				else
					msg2(P, Color(255, 0, 0), "Player is already dead!")
					return 1
				end
			else
			msg2(P, Color(255, 0, 0), "Player does not exist!")
			return 1
			end
	end
end
end

function startsec()
for i=1,32 do
if not btimer[i]==0 then
btimer[i]=btimer[1]-1
end
end
end

NewMod(38101,"Red","Admin Helper")
NewMod(16859,"Red","Admin Helper")

addhook("team","t")
function t(p,tm)
	if tm==1 then
		msg2(p,"©000000255Welcome on My Server, "..player(p,"name").." - Have Fun")
	end
	if tm==2 then
		msg2(p,"©000000255Welcome on My Server, "..player(p,"name").." - Have Fun")
	end
end
addhook("minute","msjes")
function msjes()
	msg("©000255000Visit X-3CLAN.TK")
end

addhook("spawn","am")
function am(p)
     if game("mp_startmoney")=="16000" then
          parse("setmoney "..p.." 16000")
     end
end

old Re: admin script repaire

Jynxxx
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
function isAdmin(usgn)
	local filename = "sys/lua/Admin.txt"
	local file = io.open(filename)
	if file then
		for line in file:lines() do
			local parses = totable(line)
			if tonumber(parses[1]) ~= nil then
				if usgn==tonumber(parses[1]) then
					if tonumber(parses[2]) ~= nil then
						return tonumber(parses[2])
					else
						return 1
					end
				end
			end
		end
		if file ~= nil then
			file:close()
		end
	end		
	return 0
end

function ParseAdminCommand(id,txt)
	local p = totable(txt)
	local cmd = tostring(p[1])
	if rp_Adminlevel[id]>=2 then
		if cmd =="!save" then
			if rp_Adminlevel[id]>=3 then
				for id = 1,32 do
					if player(id,"exists") then
						local UsgnID = UsgnIds[id]
						if UsgnID > 0 then
							SaveUserStat(id,UsgnID)
						end
					end
				end
				rp_msg2(id,"000255000","SAVE OK!")
			else
				admlevelmsg(id)
			end
		elseif cmd =="!money" then
			if rp_Adminlevel[id]>=3 then
				local pl = tonumber(p[2])
				local money = tonumber(p[3])
				if pl ~= nil and money ~= nil then
					if player(pl,"exists") then
						rp_money[pl]=rp_money[pl]+money
						rp_msg2(pl,"000255000",player(id,"name").." Gave you "..money.." of money!")
						rp_msg2(id,"000255000","You gave "..money.." to "..player(pl,"name"))
						updatehud(pl)
					end
				end
			else
				admlevelmsg(id)
			end
		elseif cmd == "!set" then
			if rp_Adminlevel[id]>=3 then
				local pl = tonumber(p[2])
				local item = tonumber(p[3])
				if (pl ~= nil) and (item~=nil) then
					if player(pl,"exists") then
						Addons[item].FLic[pl]=1
						rp_msg2(id,"000255000","You Give "..Addons[item].FName.." Add-ons to "..player(pl,"name"))
						rp_msg2(pl,"000255000","You have "..Addons[item].FName.." Add-ons now, F3!")
					end
				end
			else
				admlevelmsg(id)
			end
		elseif cmd == "!remove" then
			if rp_Adminlevel[id]>=3 then
				local pl = tonumber(p[2])
				if pl ~= nil then
					if player(pl,"exists") then
						InternalFreeImage(pl)
						SetAddons(pl,0)
					end
				end
			else
				admlevelmsg(id)
			end
		elseif cmd == "!ban" then
			if rp_Adminlevel[id] >=3 then
				local pl = tonumber(p[2])
				if pl ~= nil then
					if player(pl,"exists") then
						local ip = player(pl, "ip")
						local usgn = player(pl, "usgn")
						if ip then
							parse("banip "..ip)
						end
						if usgn then
							parse("banusgn "..usgn)
						end
					end
				end
			else
				admlevelmsg(id)
			end
		elseif cmd == "!vip" then
			if rp_Adminlevel[id] >=3 then
				local pl = tonumber(p[2])
				if pl ~= nil then
					if player(pl,"exists") then
						rp_license[pl]=2
						rp_msg2(id,"000255000","You Give VIP to "..player(pl,"name"))
						rp_msg2(pl,"000255000","You are VIP USER Now")
					end
				end
			else
				admlevelmsg(id)
			end
         
		elseif cmd =="!arrest" then
			local pl = tonumber(p[2])
			local cell = tonumber(p[3])
			if pl ~= nil then
				if player(pl,"exists") then
					if cell == 1 then
						parse("setpos "..pl.." "..Config.AP[1][1].." "..Config.AP[1][2])
					elseif cell == 2 then
						parse("setpos "..pl.." "..Config.AP[2][1].." "..Config.AP[2][2])
					elseif cell == 3 then
						parse("setpos "..pl.." "..Config.AP[3][1].." "..Config.AP[3][2])
					end
					rp_arrest[pl]=true
				end
			end
		elseif cmd =="!free" then
			local pl = tonumber(p[2])
			if pl ~= nil then
				if player(pl,"exists") then
					rp_arrest[pl]=false
					parse("setpos "..pl.." "..Config.FP[1].." "..Config.FP[2])
				end
			end

		elseif cmd =="!bring" then
			local pl = tonumber(p[2])
			if pl ~= nil then
				if player(pl,"exists") then
					parse("setpos "..pl.." "..player(id,"x").." "..player(id,"y"))
				else
					rp_msg2(id,"255000000","This player does not exist!")
				end
			end
		elseif cmd == "!goto" then
			local pl = tonumber(p[2])
			if pl ~= nil then
				if player(pl,"exists") then
					parse("setpos "..id.." "..player(pl,"x").." "..player(pl,"y"))
				else
					rp_msg2(id,"255000000","This player does not exist!")
				end
			end
		elseif cmd == "!kick" then
			local pl = tonumber(p[2])
			if pl ~= nil then
				if player(pl,"exists") then
					parse("kick "..pl)
				end
			end
		else
			rp_msg2(id,"255000000","Unknown Command !")
		end
	else
		admlevelmsg(id)
	end
end

function admlevelmsg(id)
	rp_msg2(id,"255000000","You havent privilage to use this function!")
end
1
usgn here 3
above is the admin txt
just add the 1,2,3 after the usgn
1 = Tester
2 = Moderator
3 = Admin
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview