Forum

> > CS2D > Scripts > Admins shouldn't kick other admins
Forums overviewCS2D overview Scripts overviewLog in to reply

English Admins shouldn't kick other admins

2 replies
To the start Previous 1 Next To the start

moved Admins shouldn't kick other admins

MortalS
User Off Offline

Quote
Hi us

I need help to function xx3 does not affect the administrator of AdminList, (don't kick administrators)

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
adminlist = {74551}

addhook("serveraction" , "Funcion22")
function Funcion22(id,act)
for _,usgn in ipairs(adminlist) do
if player(id,'usgn') == usgn then
if act==2 then
menu(id,"Menu,Kick")
end
end
end
end

addhook("menu" , "Funcion23")
function Funcion23(id,title,b)
if title=="Menu" then
if b==1 then
menu(id,"Kick Página <ADM> 1,"..exist(1).."|1,"..exist(2).."|2,"..exist(3).."|3,"..exist(4).."|4,"..exist(5).."|5,"..exist(6).."|6,"..exist(7).."|7,"..exist(8).."|8,Siguiente Página")
end
elseif title=="Kick Página <ADM> 1" then
if b==9 then
menu(id,"Kick Página <ADM> 2,"..exist(9).."|9,"..exist(10).."|10,"..exist(11).."|11,"..exist(12).."|12,"..exist(13).."|13,"..exist(14).."|14,"..exist(15).."|15,"..exist(16).."|16,Siguiente Página")
elseif b~=0 then
xx3(b)
end
elseif title=="Kick Página <ADM> 2" then
if b==9 then
menu(id,"Kick Página <ADM> 3,"..exist(17).."|17,"..exist(18).."|18,"..exist(19).."|19,"..exist(20).."|20,"..exist(21).."|21,"..exist(22).."|22,"..exist(23).."|23,"..exist(24).."|24,Siguiente Página")
elseif b~=0 then
xx3(b+8)
end
elseif title=="Kick Página <ADM> 3" then
if b==9 then
menu(id,"Kick Página <ADM> 4,"..exist(25).."|25,"..exist(26).."|26,"..exist(27).."|27,"..exist(28).."|28,"..exist(29).."|29,"..exist(30).."|30,"..exist(31).."|31,"..exist(32).."|32,Cerrar menu")
elseif b~=0 then
xx3(b+16)
end
elseif title=="Kick Página <ADM> 4" then
if b~=0 then
xx3(b+24)
end
end
end

function exist(param)
     if player(param,"exists") then
     return player(param,"name")
     else
          return "(Nadie)"
     end
end

function xx3(pl)
parse("kick "..pl.." \" Has sido <Kickeado> por la administración\" ")
msg("©255255255[Info] La id ©255255000"..pl.."©255255255 fue kickeada.")
end

Admin/mod comment

General section isn't eligible for threads like this. Also "false function to admin" title is quite the opposite of what you're saying. Fixed. /user GeoB99

old Re: Admins shouldn't kick other admins

GeoB99
Moderator Off Offline

Quote
Judging the fact from the indentation of your code, I couldn't be arsed to indent it for you as it's utterly a pain in the ass. Indenting it is always useful if you want your code to be clean and easy to be readable for other people. It makes our life easier and less hassle for everyone.

Besides, from 53 line (xx3 function) I customized it a bit like this one below:
1
2
3
4
5
6
7
8
9
10
function xx3(pl)
	for _, usgn in ipairs(adminlist) do
		if player(pl, 'usgn') ~= usgn then
			parse("kick " .. pl .. " \" Has sido <Kickeado> por la administración\" ")
			msg("©255255255[Info] La id ©255255000" .. pl .. "©255255255 fue kickeada.")
		elseif player(pl, 'usgn') == usgn then
			msg2(pl, "You cannot kick this player because he's an administrator!")
		end
	end
end
Yeah, it kinda looks like a wild method by using two for loops with same argument but frankly it works without an issue. To describe what the 3 line actually does in words: IF the player's USGN ID isn't in the adminlist table which is checked through usgn conditional of for loop then the kick command will be parsed to the respective player. Otherwise the player won't be kicked.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview