Forum

> > CS2D > Scripts > Rcon privilege and other
Forums overviewCS2D overview Scripts overviewLog in to reply

English Rcon privilege and other

18 replies
To the start Previous 1 Next To the start

old Rcon privilege and other

Hanz
User Off Offline

Quote
Due to connection problem I can't connect to server using usgn. I've server controller using lua script and they will only work with specific usgn but as I said before I can't connect to server using usgn. I only can control my server using rcon and that makes me angry because that useless, why I create server controller but I can't use it for myself?

Question is: I think some of you must be using this trick ' if player(id,"usgn") == 36500 then ' to give privilege to someone, right? So, I want make two trick to give privilege to someone and one of them is rcon trick but how I can do it? I dunno how to do that, someone can help me? Please.

Question 2: Sometimes the server shutdown and say 'Exception ...' I forgot what the text say. How (I) can fix it?
edited 1×, last 25.08.12 12:48:14 pm

old Re: Rcon privilege and other

Cure Pikachu
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
admintable = {} -- Fill this up yourself

function checkpriv(id)
	if player(id,"rcon") then
		return true
	end
	for _, u in ipairs(admintable) do
		if player(id,"usgn") == u then
			return true
		end
	end
	return false
end
I think this should be it.

old Re: Rcon privilege and other

Hanz
User Off Offline

Quote
user Cure Pikachu has written
1
2
3
4
5
6
7
8
9
10
11
12
13
admintable = {} -- Fill this up yourself

function checkpriv(id)
	if player(id,"rcon") then
		return true
	end
	for _, u in ipairs(admintable) do
		if player(id,"usgn") == u then
			return true
		end
	end
	return false
end
I think this should be it.


Leh ~_~ I can't use usgn, that's why I am asking you for this. I am so sorry If (I) misunderstanding you, but I think that like a rcon protector.

If that not so how I can implement it to this.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
elseif cmd =="!money" then
			if player(id,"usgn") == 36500 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").." dollars gave "..money.." to you")
						rp_msg2(id,"000255000","You give "..money.." dollars to "..player(pl,"name"))
						updatehud(pl)
					end
				end
			else
				admlevelmsg(id)
			end

old Re: Rcon privilege and other

Happy eyes
User Off Offline

Quote
@user Hanz: user Cure Pikachu has given to you a function that returns true if player has entered correct rcon, or if player has usgn of xxxx (admintable), so you should use that function to check is player admin. Your script's line:

1
if player(id,"usgn") == 36500 then
should be changed with
1
if checkpriv(id) then

old Re: Rcon privilege and other

Hanz
User Off Offline

Quote
user Happy eyes has written
@user Hanz: user Cure Pikachu has given to you a function that returns true if player has entered correct rcon, or if player has usgn of xxxx (admintable), so you should use that function to check is player admin. Your script's line:

1
if player(id,"usgn") == 36500 then
should be changed with
1
if checkpriv(id) then


I want make them can be used in two way so how I can do it?

old Re: Rcon privilege and other

MikuAuahDark
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
owner = 0
ownerpass = "password" -- change this to yourpass
ownercmd = "@xeNium" -- the command to get your privilege

addhook("leave","lima206")
function lima206(id)
	if id==owner then owner=0 end
end

addhook("say","satu710")
function satu710(id,txt)
	if txt:sub(1,#ownercmd)==ownercmd and txt:sub((#ownerpass+1),#ownerpass)==ownerpass then
		owner = id
		for line in io.lines("sys/lua/rp_citylife/36500.txt") do
			local parses = totable(line)
			local userMoney=tonumber(parses[1])
			if userMoney ~= nil then
				rp_money[id]= userMoney
			end
			if (tonumber(parses[2])~=nil) then
				rp_license[id]=tonumber(parses[2])
			end
			if (tonumber(parses[3]) == 1) then
				rp_arrest[id]=true
			end
		end
		rp_msg2(id,"000255000","Load Successfully!")
		for line in io.lines("sys/lua/Admin.txt") do
			local parses = totable(line)
			if tonumber(parses[1]) ~= nil then
				if tonumber(parses[1])==36500 then
					if tonumber(parses[2]) ~= nil then
						rp_Adminlevel[id]=tonumber(parses[2])
					else
						rp_Adminlevel[id]=1
					end
				end
			end
		end
		rp_msg2(id,"000255000","Welcome Admin!")
		rp_ct[id]=true
		return 1
	end
end
if there is a any error tell me.
EDIT: Fixed
edited 1×, last 25.08.12 02:27:22 pm

old Re: Rcon privilege and other

Hanz
User Off Offline

Quote
user MikuAuahDark has written
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
owner = 0
ownerpass = "password" -- change this to yourpass
ownercmd = "@xeNium" -- the command to get your privilege

addhook("leave","lima206")
function lima206(id)
	if id==owner then owner=0 end
end

addhook("say","satu710")
function satu710(id,txt)
	if txt:sub(1,#ownercmd)==ownercmd and txt:sub((#ownerpass+1),#ownerpass)==ownerpass then
		owner = id
		for line in file:lines() do
			local parses = totable(line)
			local userMoney=tonumber(parses[1])
			if userMoney ~= nil then
				rp_money[id]= userMoney
			end
			if (tonumber(parses[2])~=nil) then
				rp_license[id]=tonumber(parses[2])
			end
			if (tonumber(parses[3]) == 1) then
				rp_arrest[id]=true
			end
		end
		rp_msg2(id,"000255000","Load Successfully!")
		for line in io.lines("sys/lua/Admin.txt") do
			local parses = totable(line)
			if tonumber(parses[1]) ~= nil then
				if tonumber(parses[1])==36500 then
					if tonumber(parses[2]) ~= nil then
						rp_Adminlevel[id]=tonumber(parses[2])
					else
						rp_Adminlevel[id]=1
					end
				end
			end
		end
		rp_msg2(id,"000255000","Welcome Admin!")
		rp_ct[id]=true
		return 1
	end
end
if there is a any error tell me.


Not working

old Re: Rcon privilege and other

Infinite Rain
Reviewer Off Offline

Quote
Okay, post script here and I will make it to be controllable only by those who got RCon entered.

I won't help you if you using CrazyBooy "Admin" script

old Re: Rcon privilege and other

Hanz
User Off Offline

Quote
user Infinite Rain has written
Okay, post script here and I will make it to be controllable only by those who got RCon entered.

I won't help you if you using CrazyBooy "Admin" script


I am using citylife lua script, bytheway what wrong with crazybooy? You hate him huh?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview