Post Wed Oct 14, 2009 10:48 pm

Managing your DarkRP Admins

Update! October 20, 2013 for DarkRP 2.5.0

Install the darkrpmodification addon available here: https://github.com/FPtje/DarkRPModification first. This is separate from the darkrp gamemode folder and is the new way to modify DarkRP. Our control panel as of version 4.4 installs this addon for you (and makes the steam id you enter a superadmin). To proceed manually without the control panel:

1. Upload the darkrpmodification addon to your addons folder.
2. Edit the file darkrpmodification/lua/darkrp_config/settings.lua and look for the text superadmin (it should appear just once). The text should look like this:

  Code:
GM.Config.DefaultPlayerGroups = {
        ["STEAM_0:0:00000000"] = "superadmin",
        ["STEAM_0:0:11111111"] = "admin",
}

3. Change the STEAM_0:0:00000000 to your steam id and restart the server.


Older Instructions for DarkRP 2.4:

Recently DarkRP was updated to use the sqlite database that comes with Garry's Mod. Typically there isn't much in the database but after you install DarkRP 2.4.2 you will end up with some extra tables in that database, and more extra tables after you first start your DarkRP 2.4.2 server. These instructions will help you manually add admins for DarkRP, should you be inclined to do so.

The database file is called "sv.db", it lives in the "/orangebox/garrysmod" folder, the same folder where the "addons" and "gamemodes" folders exist.

To get the binaries you need to access and edit this database, check here: http://www.sqlite.org/download.html

For reference on what commands you can use in sqlite, check here: http://www.sqlite.org/docs.html

You'll need to execute the sqlite3 command followed by the name of the database file. Any changes to this file while the server is running may require server reboot to take effect.

On windows you should download the sqlite shell for win32, extract it to someplace like "C:\Local" copy sv.db to "C:\Local" as well, on linux you just need to be in the same folder as sv.db as many linux distros already include the binaries.

Open a command prompt by going to "Start"->"Run" and entering "cmd" in the box and clicking ok.

Type "cd C:\Local", you should now be at the "C:\Local>" prompt.

Type "sqlite3.exe sv.db" to open the database, the screen displays output similar to this:

  Code:
C:\Local>sqlite3.exe sv.db
SQLite version 3.7.12.1 2012-05-22 02:45:53
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>


The admins are stored in a table called "FAdmin_PlayerGroup", to manually add an admin we use the syntax:

INSERT INTO "FAdmin_PlayerGroup" VALUES('STEAM_0:0:000000', 'superadmin');

You'll want to replace STEAM_0:0:000000 with your steam ID of course.

Here is some output showing running that command (ran twice with 2 fictional steamIDs), we also run the "select * from FAdmin_PlayerGroup;" command to make sure the admins are now listed:

  Code:
sqlite> INSERT INTO "FAdmin_PlayerGroup" VALUES('STEAM_0:12345', 'superadmin');
sqlite> INSERT INTO "FAdmin_PlayerGroup" VALUES('STEAM_0:0:00000', 'superadmin');
sqlite> select * from FAdmin_PlayerGroup;
STEAM_0:0:00000|superadmin
STEAM_0:12345|superadmin
sqlite>


You can now type the command ".exit" at the "sqlite>" prompt and hit enter. The program finishes. Upload sv.db to your server and restart the server, the steam IDs you've added should now be able to have admin access to the server (the admin buttons are in the "TAB" menu).

Old (Deprecated Method)

This tutorial will discuss how you can add admins to your garrysmod server. This tutorial requires you know how to find your steam ID, find that tutorial here: viewtopic.php?f=10&t=39 This tutorial also requires that you already have a working knowledge of FTP and how to use it with your server. If you do not, please read that tutorial, here first: viewtopic.php?f=10&t=35, then come back. Thank you.

Now, to get started.

FTP to your server to the /gamemodes/DarkRP/gamemode

Open the file called "admins.lua" it should look something like this:

  Code:
-- admins.lua v 2.0 by philxyz

RPAdmins = {}


-- If you set this to true, all permissions are cleared from the database, so every admin gets lost, nothing gets saved
-- and only the players listed here are inserted, _every_ time you start DarkRP
-- NOTE TURNING THIS TO TRUE WILL BREAK THE SAVING ON RP_GRANT AND RP_REVOKE!
-- SO KEEP YOUR HANDS OFF IT AND LEAVE IT TO FALSE IF YOU WANT TO USE RP_GRANT AND RP_REVOKE
-- YES THIS FILE STILL WORKS IF THIS IS SET TO FALSE
reset_all_privileges_to_these_on_startup = false

-- To configure a player, assign permissions to them in the following way:
-- RPAdmins["STEAM_ID"] = {LIST, OF, PERMISSIONS}


-- HOW TO GET A STEAM ID:
-- 1. JOIN AN INTERNET SERVER (NOT YOURS, UNLESS IT IS DEDICATED AND NON LAN)
-- 2. TYPE status IN CONSOLE
-- 3. IT WILL LIST STEAM IDs
-- 4. STEAM IDS ALWAYS START WITH STEAM_

-- HOW TO GRANT PRIVILEGES TO PLAYERS WHEN IN-GAME:
-- Super admin can use rp_grant or rp_revoke [admin|mayor|cp|tool|phys|prop] <Player>
-- while in-game to assign and remove privileges during the game without restarting the server


/*HERE IS HOW TO MAKE AN ADMIN IN THIS FILE IF YOU'RE TOO LAZY TO USE RP_GRANT OR RP_REVOKE:*/ --[[

DO NOT AdD ADMINS HERE, THESE ARE EXAMPLES:
RPAdmins["STEAM_1:0:12345678"] = {ADMIN, MAYOR, CP, TOOL, PHYS, PROP}
RPAdmins["STEAM_1:0:9999999"] = {MAYOR, CP, PHYS}
END OF DO NOT ADD ADMINS HERE
-- etc.]]
-- Do not change anything above this line <--
-- ADD ADMINS/PRIVILEGES UNDER THIS LINE!
------------------------------------------------------------------------------------------------------


As that file states, you add your admins at the end of the file. Here is an example where I have added a fictional steam ID with admin rights:

  Code:
-- admins.lua v 2.0 by philxyz

RPAdmins = {}


-- If you set this to true, all permissions are cleared from the database, so every admin gets lost, nothing gets saved
-- and only the players listed here are inserted, _every_ time you start DarkRP
-- NOTE TURNING THIS TO TRUE WILL BREAK THE SAVING ON RP_GRANT AND RP_REVOKE!
-- SO KEEP YOUR HANDS OFF IT AND LEAVE IT TO FALSE IF YOU WANT TO USE RP_GRANT AND RP_REVOKE
-- YES THIS FILE STILL WORKS IF THIS IS SET TO FALSE
reset_all_privileges_to_these_on_startup = false

-- To configure a player, assign permissions to them in the following way:
-- RPAdmins["STEAM_ID"] = {LIST, OF, PERMISSIONS}


-- HOW TO GET A STEAM ID:
-- 1. JOIN AN INTERNET SERVER (NOT YOURS, UNLESS IT IS DEDICATED AND NON LAN)
-- 2. TYPE status IN CONSOLE
-- 3. IT WILL LIST STEAM IDs
-- 4. STEAM IDS ALWAYS START WITH STEAM_

-- HOW TO GRANT PRIVILEGES TO PLAYERS WHEN IN-GAME:
-- Super admin can use rp_grant or rp_revoke [admin|mayor|cp|tool|phys|prop] <Player>
-- while in-game to assign and remove privileges during the game without restarting the server


/*HERE IS HOW TO MAKE AN ADMIN IN THIS FILE IF YOU'RE TOO LAZY TO USE RP_GRANT OR RP_REVOKE:*/ --[[

DO NOT AdD ADMINS HERE, THESE ARE EXAMPLES:
RPAdmins["STEAM_1:0:12345678"] = {ADMIN, MAYOR, CP, TOOL, PHYS, PROP}
RPAdmins["STEAM_1:0:9999999"] = {MAYOR, CP, PHYS}
END OF DO NOT ADD ADMINS HERE
-- etc.]]
-- Do not change anything above this line <--
-- ADD ADMINS/PRIVILEGES UNDER THIS LINE!
------------------------------------------------------------------------------------------------------
RPAdmins["STEAM_0:0:123456"] = {ADMIN}


Restart your server and you should be all set. Enjoy!