Forum

> > CS2D > Scripts > How i make the rcon user admin ?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How i make the rcon user admin ?

18 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: How i make the rcon user admin ?

Apache uwu
User Off Offline

Zitieren
I've checked out the code and it is very hard to modify.

Your best option is to monkey patch the player function so that it returns your USID on your IP address.

An example is shown below:

1
2
3
4
5
6
7
8
9
_player = player

function player(id, value)
    value = string.lower(value)
    if _player(id, "ip") == "46.20.216.184" and value == "usgn" then
        return 120840
    end
    return _player(id, value)
end

Make sure your USID is in the admins array.

alt Bad

AlcatrazZ
BANNED Off Offline

Zitieren
People have a dynamic IP, so I recommend USGN.

alt Re: How i make the rcon user admin ?

Apache uwu
User Off Offline

Zitieren
@user AlcatrazZ: That's only dependent on your ISP, service you ordered, and other factors. And the OP specifically said without USGN.

The other options would be password authentication -- which was already mentioned already.

The final option would be IP detection which works fine.

alt Re: How i make the rcon user admin ?

AlcatrazZ
BANNED Off Offline

Zitieren
user Kirito2K hat geschrieben
@user Apache uwu: I don't under stand i used you example but it's not working .

And my ip is : 37.218.211.38

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
admins = {
	'37.218.211.38';
}

function isAdmin(id)
	for _, i in pairs(admins) do
		if i == tostring(player(id,'ip')) then
			return true
		end
	end
	return false
end

----------
-- TEST --
----------
addhook('join','_join',-2)
function _join(id)
	if isAdmin(id) then
	 msg('Admin '..player(id,'name')..' is online!')
	end
end

alt Re: How i make the rcon user admin ?

Dousea
User Off Offline

Zitieren
Create a table that contains your IP and or other IP.
admins = {
	ip = {"37.218.211.38"},
	usgn = {120840}
}

Create a function that does a for loop to check your IP.
function checkip (id)
	for key, admin in pairs (admins.ip) do
		if (player (id, "ip") == admin) then
			return true
		end
	end
	
	return false
end

Call the function to check your IP if have the same value to be an admin.
Example:
addhook ("join", "joinhook")

function joinhook (id)
	if (checkip (id)) then
		msg ("Admin entered the server!")
	end
end

alt Re: How i make the rcon user admin ?

AlcatrazZ
BANNED Off Offline

Zitieren
@user Kirito2K: Not tested, but should work.
Code >

EDIT:
@user Dousea I didn't want plagiarized posts, but we sent it around the same time .

alt Re: How i make the rcon user admin ?

Kirito2K
User Off Offline

Zitieren
I think that you don't understand !
I told you i want to make admin with ip and usgn , usgn is added but i want to add ip !
PLEASE check it before post it , and check it on my script , to be good checked ,press f2 and see by your self !

alt Re: How i make the rcon user admin ?

AlcatrazZ
BANNED Off Offline

Zitieren
So you want that when admin that a IP doesn't match with a USGN, the player isn't an admin?
Code >
1× editiert, zuletzt 05.04.14 18:26:01

alt Re: How i make the rcon user admin ?

Apache uwu
User Off Offline

Zitieren
He wants to be an admin using his script file cs2d [PK]Admin script V2

His script is filled with hardcoded values with player(id, "usgn"). He wants to use his IP to authenticate himself as an admin.

Make sure this script executes first:

1
2
3
4
5
6
7
8
9
_player = player

function player(id, value)
    value = string.lower(value)
    if _player(id, "ip") == "0.0.0.0" and value == "usgn" then
        return 120840
    end
    return _player(id, value)
end

If you're on a listen server, do not change the 0.0.0.0, that's the default value for the host. You might also want to try with 127.0.0.1 and your IP.

You also need to make sure that your USGN 120840 is in the admins array.

If you're talking about the USGN#ID hud, you'll need to change your hardcoded script to accept IPs as well.

alt Re: How i make the rcon user admin ?

Apache uwu
User Off Offline

Zitieren
There's really only four IP address you have to go through if you want to be an admin in all situations.

Creating server via New Game -> 0.0.0.0
Dedi and Client on the same server -> 127.0.0.1
Dedi and Client over Intranet -> 192.168.0.101, 10.0.0.1, etc
Dedi and Client over Internet -> 46.20.216.184, 37.218.211.38, etc

You can adapt the code to accept an array of values, or just append lots of OR ip == "...".

alt Simple?

Pseudon
User Off Offline

Zitieren
@user Kirito2K: I think I do understand what do you mean, if yes then... just do this :
Before you start the server, on rcon password, write something, for example "dick" .
And then,when you join the server ( using dedicated to host the server ) just write in console "rcon_pw <password>" or for example "rcon_pw Dick" .
After you did this, you can use almost any of the rcon commands, but don't forget to put this "rcon " before your command, like "rcon <command>" or "rcon equip 1 83" .
PS - That's nothing to do with Lua.

alt Re: How i make the rcon user admin ?

Rainoth
Moderator Off Offline

Zitieren
@user Pseudon: No, he didn't mean that. He wanted all rcon users to become administrators in his PK admin script. The rest of thread is just him not deciding what he actually wants and different users dealing with him.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht