About
GitHub: https://github.com/sbox-addons/DarkRP (Contributions welcome)
BETA: everything below works in testing; please report bugs in the comments.
[table]
[tr][th]Area[/th][th]Hooks[/th][/tr]
[tr][td]Jobs[/td][td]canChangeJob, OnPlayerChangedTeam, onPlayerDemoted, canDemote, canChangeJobTitle, CanChangeRPName, onPlayerChangedName[/td][/tr]
[tr][td]Money[/td][td]playerGetSalary, playerWalletChanged, canGiveMoney, canDropMoney, playerPickedUpMoney, moneyPrinterPrintMoney[/td][/tr]
[tr][td]Shop[/td][td]canBuyShipment, canBuyPistol, playerBoughtShipment, playerBoughtPistol, canBuyCustomEntity, playerBoughtCustomEntity, canBuyAmmo, canBuyFood[/td][/tr]
[tr][td]Police[/td][td]canArrest, canUnarrest, playerArrested, playerUnArrested, canWanted, playerWanted, playerUnWanted, playerWarranted, playerUnWarranted, playerWeaponsChecked, playerWeaponsConfiscated, playerWeaponsReturned[/td][/tr]
[tr][td]Doors[/td][td]playerBuyDoor, playerBoughtDoor, playerSoldDoor, canDoorRam, onDoorRamUsed, canLockpick, lockpickStarted, lockpickTime, onLockpickCompleted, keypadCheck[/td][/tr]
[tr][td]Mayor and votes[/td][td]canEditLaws, addLaw, removeLaw, resetLaws, canStartLockdown, lockdownStarted, lockdownEnded, canStartVote, onVoteStarted, onVoteEnded[/td][/tr]
[tr][td]Entities[/td][td]canUseEntity, playerUsedEntity, entityDestroyed, canPocket, onPocketItemAdded, canDropWeapon[/td][/tr]
[tr][td]Hits and hunger[/td][td]canRequestHit, onHitAccepted, onHitCompleted, onHitFailed, hungerUpdate[/td][/tr]
[tr][td]Chat[/td][td]PlayerSay, onChatCommand[/td][/tr]
[tr][td]Players[/td][td]playerInitialSpawn, playerDisconnected, PlayerSpawn, PlayerLoadout, PlayerDeath, configChanged[/td][/tr]
[tr][td]Prop protection[/td][td]PlayerSpawnProp, PlayerSpawnObject, CanTouchProp, CanTouchEntity[/td][/tr]
[/table]
The full guide and a complete example addon come with the addon: Docs/API.md and Docs/examples/MyCityDarkRP.csx.
DarkRP for s&box
The classic Garry's Mod roleplay gamemode, rebuilt for s&box as a Sandbox addon. Jobs, money, police, a mayor, doors, money printers, hits, a full menu and a prop protection: everything you know from DarkRP, written from scratch in C# with no Garry's Mod content needed.BETA: everything below works in testing; please report bugs in the comments.
Features
- 10 jobs: Citizen, Civil Protection, Gangster, Mob Boss, Gun Dealer, Medic, Police Chief, Mayor, Hobo and Cook, each with its own outfit, loadout, salary and limit. Vote jobs, demotions, custom job titles and RP names
- Economy: paydays, wallet, /give, /dropmoney, cheques, shipments, single weapons, ammo and buyable entities
- Police: wanted and warrants (approved by the mayor), arrest and unarrest batons, stun stick, battering ram, weapon checker, jail positions
- Mayor: laws on a law board, lockdowns, lotteries, broadcasts and agendas
- Doors: buy, sell, lock, co-owners, door titles, police and job doors, lock picks
- Entities: money printers (they can overheat), drug lab, gun lab, microwave, tip jar, letters
- Hits, hunger (optional), pocket, medic kit and keys
- DarkRP HUD: health, armour, hunger, wallet, salary timer, status, ammo and agenda. It steps aside when the Q or C menu is open
- F4-style menu (M) with jobs, shop, mayor and admin tabs, plus local, OOC, whisper, yell, group and advert chat
- DarkRP scoreboard (Tab): players grouped by job, with badges and click actions for admins
- Prop protection in the style of FPP:
- Only owners, their buddies and admins can touch a prop
- The owner box shows on the left side of the screen
- Anti prop-kill
- Map props are for admins only
- Blocked models, with wildcards
- Cloud and mounted-game content is admin-only by default
- Spawn delay and a size limit
- Props are kept for players who leave and returned if they come back
For server owners: no code needed
Everything lives in Sandbox's data folder under data/darkrp/. Like DarkRP's darkrpmodification, it survives addon updates:- config.json: nearly 100 settings (salaries, door prices, jail time, hunger, licenses...). You can also change them live with /rpconfig or the Admin tab
- jobs.json, shipments.json, entities.json, ammo.json, food.json: add your own content, or change any default by writing only the fields you want
- disabled_defaults.json: like DarkRP's, every default job, shipment, entity, law and module (hunger, hits, HUD, prop protection) switches off with true
- propprotection.json: also editable in game under Spawn menu > Utilities > Server > Prop Protection
- reference/: everything currently loaded, in the same format, ready to copy
- README.txt: every setting and command, generated from the version you run
For developers: extend DarkRP from your own addon
Add jobs, shipments, entities, ammo, food, categories, door groups, agendas, chat commands and hooks without touching this addon:
public sealed class MyCity : GameObjectSystem
{
public MyCity( Scene scene ) : base( scene )
{
DarkRP.OnLoad( scene, "mycity", () => Register() );
}
static void Register()
{
DarkRP.CreateJob( "Security Guard", new RPJob { Command = "guard", Color = "#3c78c8", Salary = 60, Max = 3 } );
DarkRP.AddChatCommand( "shift", "Start your shift.", cmd => cmd.Reply( "Clocked in!" ) );
DarkRP.AddHook( "playerGetSalary", "mycity_bonus", h => { if ( h.Job.Command == "guard" ) h.Amount += 10; } );
DarkRP.RegisterEntityType( new RPEntityType { Id = "my_radio", Name = "Radio", Component = "MyRadio", Model = "models/sbox/home/tv/tv.vmdl", Touch = "physgun,pickup" } );
}
}
- Content: CreateJob, CreateShipment, CreateEntity, CreateAmmoType, CreateFood, CreateCategory, AddDoorGroup, CreateAgenda, CreateGroupChat, CreateDemoteGroup, AddDefaultLaw, Disable, DisableModule
- Players and money: GetMoney, AddMoney, CanAfford, ChangeJob, IsCP, Notify, ChatTo, Config()
- Your own entities: a component plus DarkRP's RPEntity gives owner, label, price, health and use handling
- Prop protection, DarkRP's CPPI: DarkRP.CanTouch(player, object, "physgun") and DarkRP.GetOwner(object). Entity types choose what owners may do (Touch), and the CanTouchEntity hook overrides it
Supported hooks
Hooks get an RPHook (Player, Target, Job, Amount, Text, Reason, Entity...). They can Deny(reason), change values, or stop later hooks.[table]
[tr][th]Area[/th][th]Hooks[/th][/tr]
[tr][td]Jobs[/td][td]canChangeJob, OnPlayerChangedTeam, onPlayerDemoted, canDemote, canChangeJobTitle, CanChangeRPName, onPlayerChangedName[/td][/tr]
[tr][td]Money[/td][td]playerGetSalary, playerWalletChanged, canGiveMoney, canDropMoney, playerPickedUpMoney, moneyPrinterPrintMoney[/td][/tr]
[tr][td]Shop[/td][td]canBuyShipment, canBuyPistol, playerBoughtShipment, playerBoughtPistol, canBuyCustomEntity, playerBoughtCustomEntity, canBuyAmmo, canBuyFood[/td][/tr]
[tr][td]Police[/td][td]canArrest, canUnarrest, playerArrested, playerUnArrested, canWanted, playerWanted, playerUnWanted, playerWarranted, playerUnWarranted, playerWeaponsChecked, playerWeaponsConfiscated, playerWeaponsReturned[/td][/tr]
[tr][td]Doors[/td][td]playerBuyDoor, playerBoughtDoor, playerSoldDoor, canDoorRam, onDoorRamUsed, canLockpick, lockpickStarted, lockpickTime, onLockpickCompleted, keypadCheck[/td][/tr]
[tr][td]Mayor and votes[/td][td]canEditLaws, addLaw, removeLaw, resetLaws, canStartLockdown, lockdownStarted, lockdownEnded, canStartVote, onVoteStarted, onVoteEnded[/td][/tr]
[tr][td]Entities[/td][td]canUseEntity, playerUsedEntity, entityDestroyed, canPocket, onPocketItemAdded, canDropWeapon[/td][/tr]
[tr][td]Hits and hunger[/td][td]canRequestHit, onHitAccepted, onHitCompleted, onHitFailed, hungerUpdate[/td][/tr]
[tr][td]Chat[/td][td]PlayerSay, onChatCommand[/td][/tr]
[tr][td]Players[/td][td]playerInitialSpawn, playerDisconnected, PlayerSpawn, PlayerLoadout, PlayerDeath, configChanged[/td][/tr]
[tr][td]Prop protection[/td][td]PlayerSpawnProp, PlayerSpawnObject, CanTouchProp, CanTouchEntity[/td][/tr]
[/table]
The full guide and a complete example addon come with the addon: Docs/API.md and Docs/examples/MyCityDarkRP.csx.

![WheelOfLuck [DarkRP] thumbnail](https://sbox.watch/collected-media/663504e28479b26ac7bd82176bd2fd97.webp/@@images/image-256-e450229bffec5d1714b9e904d70c4075.webp)