CityRP Documentation Repository

GM

Primary Gamemode Bootstrap

Functions

ClientCalcRagdollEyes(ply, Origin, Angles, FOV) → table|nilSource ☍

Parameters

  • plyany
  • Originany
  • Anglesany
  • FOVany

Returns

  1. table|nil
Clientcityrp.formattime(time, showmins) → stringSource ☍

Parameters

  • timenumber?
  • showminsboolean

Returns

  1. string
ClientDrawDeathMessage()Source ☍
ClientfireEmitters()Source ☍
ClientGM:AdjustMaximumWidth(font, text, width, addition, extra) → number|unknownSource ☍

Adjust WIDTH to be maximum value of (width of text (plus a bit)) or (width)

Parameters

  • fontstringFont name.
  • textstringText.
  • widthnumberMaximum width to set to.
  • additionnumberPost-check text padding size.
  • extranumberPre-check text padding.

Returns

  1. number|unknown
ClientGM:CalculateTime(seconds) → number, numberSource ☍

Convert seconds to a hours, minutes format.

Parameters

  • secondsnumber

Returns

  1. 1number
  2. 2number
ServerGM:CanExitVehicle(veh, ply) → booleanSource ☍

Called to check if a player is able to exit a vehicle.

Parameters

  • vehVehicleThe vehicle (or, for a seat attached to a parent vehicle, its resolved parent) being exited.
  • plyPlayerThe player attempting to exit.

Returns

  1. booleanIf the player is allowed to exit.
ServerGM:CanPlayerSuicide(ply) → booleanSource ☍

Called when a player attempts suicide.

Parameters

Returns

  1. booleanIf the suicide was allowed.
ServerGM:CanTool(ply, trace, tool) → booleanSource ☍

Called when a player attempts to use their toolgun.

Parameters

Returns

  1. booleanIf the toolgun was allowed.
ClientGM:ChatText(index, name, text, filter) → booleanSource ☍

Called when a player says something or a message is received from the server.

Parameters

  • indexany
  • nameany
  • textany
  • filterany

Returns

  1. boolean
ServerGM:CheckPassword(id64, ipAddr, svPass, clPass, name) → boolean, string|nilSource ☍

Called when a player joins and attempts to check their password.

Parameters

  • id64any
  • ipAddrany
  • svPassany
  • clPassany
  • nameany

Returns

  1. 1boolean
  2. 2string|nil
ServerGM:ConnectToDatabase()Source ☍

Connect the gamemode to the database.

ClientGM:CreateScoreboard()Source ☍

Creates the scoreboard for the server's selected version, replacing any existing one.

ServerGM:DBConnected()Source ☍

Called when the database is connected.

ServerGM:DoPlayerDeath(ply, attacker, damageInfo)Source ☍

Parameters

  • plyany
  • attackerany
  • damageInfoany
ClientGM:DrawInformation(text, font, x, y, color, alpha, left, callback, shadow) → numberSource ☍

Draw Information.

Parameters

  • textstringInformation to draw.
  • fontstringThe font to draw.
  • xnumberX position to draw at.
  • ynumberY position to draw at.
  • colorColorColour to draw in.
  • alphanumberAlpha to draw at.
  • leftboolean?If the x is the left or center point. Defaults to false.
  • callbackfun(x: number, y: number, width: number, height: number):number?, number?Callback function to overwrite the x and y positions.
  • shadowboolean?If a shadow should be drawn. Defaults to false.

Returns

  1. numberNew y position.
ServerGM:EntityKeyValue(ent, key, value)Source ☍

Called when a mapper-set keyvalue is read on an entity, for prop protection overrides.

Parameters

  • entEntityThe entity carrying the keyvalue.
  • keystringThe keyvalue name.
  • valuestringThe keyvalue value.
ServerGM:EntityTakeDamage(entity, damageInfo) → booleanSource ☍

Called when an entity takes damage.

Parameters

  • entityEntityEntity which took damage.
  • damageInfoDamageInfoInformation about the damage.

Returns

  1. booleanIf true, the damage is not applied.
ServerGM:GetOOCDelay(ply) → numberSource ☍

Get how long a player must wait between OOC messages. Quieter servers get a shorter delay: half at or below the low player count, rising linearly to the full delay at the high count. Members wait half that.

Parameters

  • plyPlayerThe player talking.

Returns

  1. numberThe delay in seconds.
ClientGM:GetScreenCenterBounce(bounce) → unknown, unknownSource ☍

Get the bouncing position of the screen's center.

Parameters

  • bouncenumber?How much the screen should bounce by. Defaults to 8.

Returns

  1. 1unknown
  2. 2unknown
ServerGM:GravGunPickupAllowed(ply, ent) → boolean|nilSource ☍

Called to check if a player is allowed to pick up an entity with the gravity gun.

Parameters

  • plyPlayerPicking up player.
  • entEntityThe entity being picked up.

Returns

  1. boolean|nilnil defers to the engine default.
ServerGM:GravGunPunt(ply, ent) → booleanSource ☍

Called when a player attempts to punt an entity with the gravity gun.

Parameters

Returns

  1. booleanIf the punt is allowed.
ClientGM:HUDAmmoPickedUp()Source ☍
ClientGM:HUDDrawScoreBoard() → booleanSource ☍

Called when the scoreboard should be drawn.

Returns

  1. boolean
ClientGM:HUDDrawTargetID()Source ☍

Called when the target ID should be drawn.

ClientGM:HUDItemPickedUp()Source ☍
ClientGM:HUDPaint() → booleanSource ☍

Called every time the HUD should be painted.

Returns

  1. boolean
ClientGM:HUDShouldDraw(name) → booleanSource ☍

A function to override whether a HUD element should draw.

Parameters

  • namestringHUD element name to draw.

Returns

  1. booleanIf the HUD element should draw.
ClientGM:HUDWeaponPickedUp()Source ☍

Override the weapon, item and ammo pickup functions.

ServerGM:Initialize()Source ☍

Run the gamemode startup procedure.

ServerGM:InitPostEntity()Source ☍

Called when all of the map entities have been initialized.

ClientGM:IsUsingCamera() → booleanSource ☍

Check if the local player is using the camera.

Returns

  1. booleanIf the local player is using a camera weapon.
ServerGM:KeyPress(ply, key)Source ☍

Called when a player presses a key.

Parameters

  • plyPlayerThe player who pressed the key.
  • keynumberThe key enum pressed.
ServerGM:KeyRelease(ply, key)Source ☍

Called when a player releases a key.

Parameters

  • plyPlayerPlayer who pressed the key.
  • keynumberKEY_ enum which was pressed.
ClientGM:OnEntityCreated(ent)Source ☍

Called when an entity is created.

Parameters

  • entEntityThe entity that was created.
ServerGM:OnPhysgunReload(weapon, ply) → boolean|nilSource ☍

Called when a player reloads the physgun on an entity, to check if it may be dropped/removed.

Parameters

Returns

  1. boolean|nilnil defers to the engine default.
ServerGM:OnUpdateDatabase()Source ☍

Called whenever the database is updated. Typically on a 60s timer.

ServerGM:PhysgunDrop(ply, ent)Source ☍

Called when a player attempts to drop an entity with the physics gun.

Parameters

  • plyPlayerDropping player.
  • entEntityThe entity being dropped.
ServerGM:PhysgunPickup(ply, ent) → boolean|nilSource ☍

Called when a player attempts to pick up an entity with the physics gun.

Parameters

  • plyPlayerPicking up player.
  • entEntityThe entity being picked up.

Returns

  1. boolean|nilIf the pickup was allowed.
ServerGM:PlayerArrest(ply, tgt) → boolean|nilSource ☍

Called when a player is arresting another player.

Parameters

  • plyPlayerThe player arresting.
  • tgtPlayerThe player being arrested.

Returns

  1. boolean|nilIf the arrest is allowed, nil for default (allowed).
ClientGM:PlayerBindPress(ply, bind, press)Source ☍

Called when a player presses a bind.

Parameters

  • plyPlayerPlayer pressing the bind.
  • bindstringThe bind being pressed.
  • pressbooleanIf the bind was depressed or unpressed.
ServerGM:PlayerCanArrest(ply, tgt) → boolean|nilSource ☍

Called when a player attempts to arrest another player.

Parameters

Returns

  1. boolean|nilIf the pickup arrest was allowed.
ServerGM:PlayerCanDemote(ply, tObj) → boolean, string|nilSource ☍

Called when a player attempts to demote another player.

Parameters

  • plyPlayerThe player demoting the target.
  • tObjPlayerThe player being demoted.

Returns

  1. 1booleanIf the demote was allowed.
  2. 2string|nilIf the demote was not allowed, a reason to display to the player. If no string is provided, no error is shown.
ServerGM:PlayerCanDrop(ply, weapon, silent, attacker) → boolean|nilSource ☍

Called when a player drops a weapon.

Parameters

  • plyPlayerThe player dropping a weapon.
  • weaponWeaponThe weapon being dropped.
  • silentbooleanIf the drop is "silent" (a backend drop, ie. on death).
  • attackerPlayer?The attacker for the player.

Returns

  1. boolean|nilIf the drop is allowed, nil for default (allowed).
ServerGM:PlayerCanDropItem(ply, item, amt, pos, meta) → boolean, stringSource ☍

Called when a player attempts to drop an item on the ground.

Parameters

  • plyPlayerThe player dropping the item.
  • itemstringThe uniqueID of the item being dropped.
  • amtnumberThe amount of items being dropped.
  • posVectorThe position that the items would be created at.
  • metastring?The item metadata key for the stack being dropped.

Returns

  1. 1booleanIf the drop was allowed.
  2. 2stringError message to display to the player, if any.
ServerGM:PlayerCanEarnContraband(ply) → booleanSource ☍

Checks if a player can earn contraband.

Parameters

  • plyPlayerThe player earning.

Returns

  1. booleanIf the earn was allowed.
ServerGM:PlayerCanGainFrag(ply, victim) → booleanSource ☍

Hook function called when a player gains a kill.

Parameters

  • plyPlayerPlayer gaining a kill.
  • victimPlayerPlayer who was killed.

Returns

  1. booleanIf the frag is allowed to be counted.
ServerGM:PlayerCanGiveItem(ply, item, amt, to, meta) → boolean, stringSource ☍

Called when a player attempts to give an item to another player.

Parameters

  • plyPlayerThe player giving the item.
  • itemstringThe uniqueID of the item being given.
  • amtnumberThe amount of items being given.
  • toPlayerThe player being given the items.
  • metastring?The item metadata key for the stack being given.

Returns

  1. 1booleanIf the give was allowed.
  2. 2stringError message to display to the player, if any.
ServerGM:PlayerCanHearPlayersVoice(ply, tgt) → booleanSource ☍

Hook function called to check if a player can be heard.

Parameters

  • plyPlayerThe player listening.
  • tgtPlayerThe player speaking.

Returns

  1. booleanIf the voice can be heard.
ServerGM:PlayerCanHolster(ply, weapon, silent) → boolean|nilSource ☍

Called when a player holsters a weapon.

Parameters

  • plyPlayerThe player holstering a weapon.
  • weaponWeaponThe weapon being holstered.
  • silentbooleanIf the holster is "silent" (a backend holstering ie. on death).

Returns

  1. boolean|nilIf the holster is allowed, nil for default (allowed).
ServerGM:PlayerCanJoinTeam(ply, team) → booleanSource ☍

Check if a player can join a team.

Parameters

  • plyPlayerThe player changing team.
  • teamnumberThe new team.

Returns

  1. booleanIf the player can join the team.
ServerGM:PlayerCanKnockOut(ply, tgt) → booleanSource ☍

Called when a player attempts to knock out another player.

Parameters

  • plyPlayerThe player knocking out.
  • tgtPlayerThe player being knocked out.

Returns

  1. booleanIf the knockout is allowed.
ServerGM:PlayerCanOwnDoor(ply, door) → boolean|nilSource ☍

Called when a player buys a door.

Parameters

  • plyPlayerThe player owning the door.
  • doorEntityThe door being owned.

Returns

  1. boolean|nilIf the purchase is allowed, nil for default (allowed).
ServerGM:PlayerCanPromote(ply, tgt) → booleanSource ☍

Called when a player attempts to promote another player.

Parameters

  • plyPlayerThe player promoting the target.
  • tgtPlayerThe player being promoted.

Returns

  1. booleanIf the promote was allowed.
ServerGM:PlayerCanRamDoor(ply, door, silent) → booleanSource ☍

Called when a player attempts to ram a door.

Parameters

  • plyPlayerThe player ramming the door.
  • doorEntityThe door being rammed.
  • silentbooleanIf the ram is silent.

Returns

  1. booleanIf the ram is allowed.
ServerGM:PlayerCanRemoveItem(ply, item) → boolean, stringSource ☍

Called when a player attempts to remove an item.

Parameters

  • plyPlayerThe player removing the item.
  • itemstringThe uniqueID of the item being removed.

Returns

  1. 1booleanIf the removal was allowed.
  2. 2stringError message to display to the player, if any.
ServerGM:PlayerCanSayIC(ply, text) → booleanSource ☍

Check if a player can say IC text.

Parameters

  • plyPlayerThe player talking.
  • textstringThe words said.

Returns

  1. booleanIf the chat will be shown.
ServerGM:PlayerCanSayLOOC(ply, text) → booleanSource ☍

Check if a player can say Local OOC text.

Parameters

  • plyPlayerThe player talking.
  • textstringThe words said.

Returns

  1. booleanIf the chat will be shown.
ServerGM:PlayerCanSayOOC(ply, text) → booleanSource ☍

Check if a player can say OOC text.

Parameters

  • plyPlayerThe player talking.
  • textstringThe words said.

Returns

  1. booleanIf the chat will be shown.
ServerGM:PlayerCanSellItem(ply, item, amt, meta) → boolean, stringSource ☍

Called when a player attempts to sell an item from inventory.

Parameters

  • plyPlayerThe player selling the item.
  • itemstringThe uniqueID of the item being sold.
  • amtnumberThe amount of items being sold.
  • metastring?The item metadata key for the stack being sold.

Returns

  1. 1booleanIf the sell was allowed.
  2. 2stringError message to display to the player, if any.
ServerGM:PlayerCanUnarrest(ply, tgt) → boolean|nilSource ☍

Called when a player attempts to unarrest another player.

Parameters

  • plyPlayerPicking up player.
  • tgtPlayerThe entity being picked up.

Returns

  1. boolean|nilIf the pickup was allowed.
ServerGM:PlayerCanUnwarrant(ply, tgt) → booleanSource ☍

Called when a player attempts to unwarrant a player.

Parameters

  • plyPlayerThe player unwarranting the target.
  • tgtPlayerThe player being unwarranted.

Returns

  1. booleanIf the unwarrant was allowed.
ServerGM:PlayerCanUseCommand(ply, command, arguments) → booleanSource ☍

Check if a player can run a command.

Parameters

  • plyPlayerThe calling player.
  • commandstringThe command being ran.
  • argumentstableThe arguments table.

Returns

  1. booleanIf the command is allowed.
ServerGM:PlayerCanUseDoor(ply, door) → booleanSource ☍

Called when a player attempts to use a door.

Parameters

  • plyPlayerThe player using the door.
  • doorEntityThe door being used.

Returns

  1. booleanIf the use is allowed.
ServerGM:PlayerCanUseItem(ply, item, silent) → booleanSource ☍

Called when a player attempts to use an item.

Parameters

  • plyPlayerThe player using an item.
  • itemstringThe item being used.
  • silentbooleanIf the use is silent.

Returns

  1. booleanIf the use is allowed.
ServerGM:PlayerCanViewDoor(ply, door) → boolean|nilSource ☍

Called when a player views a door.

Parameters

  • plyPlayerThe player viewing the door.
  • doorEntityThe door being viewed.

Returns

  1. boolean|nilIf the viewing is allowed, nil for default (allowed).
ClientGM:PlayerCanVoice(ply) → booleanSource ☍

Called to check if a player can use voice.

Parameters

  • plyany

Returns

  1. boolean
ServerGM:PlayerCanWakeUp(ply, tgt) → booleanSource ☍

Called when a player attempts to wake up another player.

Parameters

  • plyPlayerThe player waking up.
  • tgtPlayerThe player being woken up.

Returns

  1. booleanIf the wakeup is allowed.
ServerGM:PlayerCanWarrant(ply, tgt) → booleanSource ☍

Called when a player attempts to warrant another player.

Parameters

  • plyPlayerThe player warranting.
  • tgtPlayerThe player being warranted.

Returns

  1. booleanIf the warrant is allowed.
ServerGM:PlayerDataLoaded(ply, success)Source ☍

Called after a player's data has finished loading and their default, session-scoped fields have been applied. success distinguishes an existing account being loaded from the database (true, via pMeta:LoadData) from a first-time player whose record has just been created (false, via pMeta:LoadDataNew).

Parameters

  • plyPlayerThe player whose data was loaded.
  • successbooleanWhether an existing save was loaded (true) or a new player record was just created (false).
ServerGM:PlayerDeath(ply, inflictor, attacker, ragdoll)Source ☍

Called when a player dies.

Parameters

  • plyPlayerDying player.
  • inflictorEntity?Damage inflictor; for crush damage from props this is often the prop while attacker is the world.
  • attackerEntityEntity which inflicted the damage.
  • ragdollbooleanReserved for future use; the only call site always passes false and it is not read by this handler.
ServerGM:PlayerDeathSound() → booleanSource ☍

Called to check if the default death sound should be played.

Returns

  1. booleanIf true, the default death sound is not played.
ServerGM:PlayerDeathThink(ply) → boolean|unknownSource ☍

Called every frame that a player is dead.

Parameters

Returns

  1. boolean|unknown
ServerGM:PlayerDemote(ply, tgt, from, reason) → boolean|nilSource ☍

Called when a player is demoting another player.

from:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. boolean|nilIf the demote is allowed.
ServerGM:PlayerDisconnected(player)Source ☍

Called when a player has disconnected.

Parameters

  • playerany
ClientGM:PlayerEndVoice(ply)Source ☍

Parameters

  • plyany
SharedGM:PlayerFootstep(ply, pos, foot, sound, vol, recip) → boolean|unknownSource ☍

Parameters

  • plyany
  • posany
  • footany
  • soundany
  • volany
  • recipany

Returns

  1. boolean|unknown
ServerGM:PlayerGiveSWEP(ply, class, wep) → booleanSource ☍

Called when a player attempts to give a SWEP.

Parameters

  • plyPlayerThe spawning player.
  • classstringThe SWEP class.
  • weptableThe weapon table.

Returns

  1. boolean
ServerGM:PlayerHostage(ply, tgt) → boolean|nilSource ☍

Called when a player hostages player.

Parameters

  • plyPlayerThe player hostaging.
  • tgtPlayerThe player being hostaged.

Returns

  1. boolean|nilIf the hostage is allowed, nil for default (allowed).
ServerGM:PlayerInitialized(ply)Source ☍

Called when the player has initialized.

Parameters

  • plyany
ServerGM:PlayerInitialSpawn(ply)Source ☍

Called when a player initially spawns.

Parameters

  • plyany
ServerGM:PlayerKnockOut(ply, tgt)Source ☍

Called by pMeta:KnockOut once a player has been knocked out, whatever the cause. To block one, use PlayerCanKnockOut.

Parameters

  • plyPlayer?Who knocked them out; nil for sleep, items and injuries, or an attacker who has since left.
  • tgtPlayerThe player knocked out.
ServerGM:PlayerLoadout(player)Source ☍

Called when a player's weapons should be given, on a real spawn. The loadouts plugin grants every weapon; plugins' playerLoadout methods then dress the player.

Parameters

ClientGM:PlayerNoClip(ply, state) → booleanSource ☍

Predicts whether the server lets the local player change noclip state; the server copy in init.lua decides and echoes.

Parameters

  • plyPlayerPlayer changing state.
  • statebooleanThe requested noclip state.

Returns

  1. booleanIf the state change was allowed.
ServerGM:PlayerPromotedToLeader(requester, target, fromTeam, toTeam)Source ☍

Called once a member has accepted a leader promotion and both players have changed team. To block one, use PlayerCanPromoteLeader.

Parameters

ServerGM:PlayerRanAdminCommand(ply, cmd, args)Source ☍

Called after an admin command is ran.

Parameters

  • plyPlayerThe player running the command.
  • cmdstringThe command ran.
  • argstableThe arguments list.
ServerGM:PlayerRanCommand(ply, cmd, args)Source ☍

Called after a command is ran.

Parameters

  • plyPlayerThe player running the command.
  • cmdstringThe command ran.
  • argstableThe arguments list.
ServerGM:PlayerSaid(ply, msg, msgType)Source ☍

Called after a player sends a message in chat.

Parameters

  • plyPlayerThe player talking.
  • msgstringThe message which was sent.
  • msgTypestringThe message type ("ic", "gagged", "arrested", or "hostaged").
ServerGM:PlayerSaidLOOC(ply, msg)Source ☍

Called after a player sends a message in Local OOC.

Parameters

  • plyPlayerThe player talking in LOOC.
  • msgstringThe message which was sent.
ServerGM:PlayerSaidOOC(ply, msg)Source ☍

Called after a player sends a message in OOC.

Parameters

  • plyPlayerThe player talking in OOC.
  • msgstringThe message which was sent.
ServerGM:PlayerSay(ply, text, public) → stringSource ☍

Hook function for when any message is sent to the server.

Parameters

  • plyPlayerThe talking player.
  • textstringThe message being sent.
  • publicbooleanIf the message is sent in team or global chat.

Returns

  1. stringOverride string to send in chat.
ServerGM:PlayerSayAdminOOC(ply, msg)Source ☍

Called after a staff member sends a message in staff OOC (!//).

Parameters

  • plyPlayerThe staff member talking in staff OOC.
  • msgstringThe message which was sent.
ServerGM:PlayerSetHandsModel(ply, ent)Source ☍

Choose the model for hands according to their player model.

Parameters

  • plyany
  • entany
ServerGM:PlayerSetModel(ply)Source ☍

Loadout hook function called when a player's model needs to be set.

Parameters

  • plyPlayerPlayer's whos model is being set.
ServerGM:PlayerShouldTakeDamage(ply, attacker) → booleanSource ☍

Called when a player should take damage.

Parameters

  • plyany
  • attackerany

Returns

  1. boolean
ServerGM:PlayerShouldTaunt(ply, act) → boolean|nilSource ☍

Called when player tries to act something out. Coded by Voluptious.

Parameters

Returns

  1. boolean|nilIf the act was allowed.
ServerGM:PlayerSpawn(ply)Source ☍

Called when a player spawns.

Parameters

ServerGM:PlayerSpawnedEffect(ply, mdl, ent)Source ☍

Called when a player has spawned an effect.

Parameters

  • plyPlayerThe player spawning the effect.
  • mdlstringThe model path being spawned.
  • entEntityThe spawned entity.
ServerGM:PlayerSpawnedProp(ply, mdl, ent)Source ☍

Called when a player has spawned a prop.

Parameters

  • plyPlayerThe player spawning the prop.
  • mdlstringThe model path being spawned.
  • entEntityThe spawned entity.
ServerGM:PlayerSpawnedRagdoll(ply, model, ent)Source ☍

Called when a player has spawned a ragdoll.

Parameters

  • plyPlayerThe player spawning the ragdoll.
  • modelstringThe model path being spawned.
  • entEntityThe spawned entity.
ServerGM:PlayerSpawnedSENT(ply, ent)Source ☍

Called when a player spawns a SENT, to assign them ownership of it.

Parameters

ServerGM:PlayerSpawnedVehicle(ply, ent)Source ☍

Called when a player spawns a vehicle, to tag its default ownership.

Parameters

ServerGM:PlayerSpawnEffect(ply, mdl) → booleanSource ☍

Called when a player attempts to spawn an effect.

Parameters

  • plyPlayerThe player spawning the prop.
  • mdlstringThe model path being spawned.

Returns

  1. booleanIf the spawn was allowed.
ServerGM:PlayerSpawnNPC(ply, class, weapon) → booleanSource ☍

Called when a player attempts to spawn an NPC.

Parameters

  • plyPlayerThe player spawning an NPC.
  • classstringThe NPC class.
  • weaponstringThe NPCs weapon.

Returns

  1. booleanIf the act was allowed.
ServerGM:PlayerSpawnProp(ply, model, state) → booleanSource ☍

Called when a player attempts to spawn a prop.

Parameters

  • plyPlayerThe player spawning the prop.
  • modelstringThe model path being spawned.
  • statestring?Optional state data.

Returns

  1. booleanIf the spawn was allowed.
ServerGM:PlayerSpawnRagdoll(ply, model) → booleanSource ☍

Called when a player attempts to spawn a ragdoll.

Parameters

  • plyPlayerSpawning player.
  • modelstringThe model being spawned.

Returns

  1. booleanIf the spawn was allowed.
ServerGM:PlayerSpawnSENT(ply, class) → booleanSource ☍

Called when attempts to spawn a SENT.

Parameters

  • plyPlayerThe spawning player.
  • classstringThe SENT class.

Returns

  1. boolean
ServerGM:PlayerSpawnSWEP(ply, class, wep) → booleanSource ☍

Called when a player attempts to spawn a SWEP.

Parameters

  • plyPlayerThe spawning player.
  • classstringThe SWEP class.
  • weptableThe weapon table.

Returns

  1. boolean
ServerGM:PlayerSpawnVehicle(ply, model) → booleanSource ☍

Called when a player attempts to spawn a vehicle.

Parameters

  • plyPlayerSpawning player.
  • modelstringThe model being spawned.

Returns

  1. booleanIf the spawn was allowed.
ServerGM:PlayerSpray(ply) → booleanSource ☍

Called when a player should be allowed to spray.

Parameters

  • plyPlayerPlayer attempting to spray.

Returns

  1. booleanIf the spray is allowed.
ClientGM:PlayerStartVoice(ply)Source ☍

Parameters

  • plyany
ServerGM:PlayerSwitchFlashlight(ply, on) → booleanSource ☍

Called when a player switches their flashlight on or off.

Parameters

  • plyPlayerThe player switching their flashlight.
  • onbooleanThe requested flashlight state.

Returns

  1. booleanIf their flashlight is allowed to change state.
ServerGM:PlayerUnarrest(ply, tgt) → boolean|nilSource ☍

Called when a player unarrests player.

Parameters

  • plyPlayerThe player unarresting.
  • tgtPlayerThe player being unarrested.

Returns

  1. boolean|nilIf the unarrest is allowed, nil for default (allowed).
ServerGM:PlayerUnwarrant(ply, tgt) → boolean|nilSource ☍

Called when a player unwarrants player.

Parameters

  • plyPlayerThe player unwarranting.
  • tgtPlayerThe player being unwarranted.

Returns

  1. boolean|nilIf the unwarrant is allowed, nil for default (allowed).
ServerGM:PlayerUse(ply, ent) → boolean|unknownSource ☍

Called when a player attempts to use an entity.

Parameters

  • plyPlayerThe player using an entity.
  • entEntityThe entity being used.

Returns

  1. boolean|unknown
ServerGM:PlayerWakeUp(ply, tgt) → boolean|nilSource ☍

Called when a player is waking up another player.

Parameters

  • plyPlayerThe player waking up.
  • tgtPlayerThe player being woken up.

Returns

  1. boolean|nilIf the wakeup is allowed, nil for default (allowed).
ServerGM:PlayerWarrant(ply, tgt, class) → boolean|nilSource ☍

Called when a player warrants a player.

--  The kinds of warrant that can be held against a player.
--  @section Type Unions
class:
    | "bolo"
    | "search"
    | "arrest"

Parameters

  • plyPlayerThe player warranting.
  • tgtPlayerThe player being warranted.
  • class"arrest"|"bolo"|"search"The warrant class.

Returns

  1. boolean|nilIf the warranting is allowed, nil for default (allowed).
ServerGM:PlyCanPickupAdmin(ply, ent) → boolean|nilSource ☍

Can a player with extended access (admin/mod) pickup this entity?

Parameters

  • plyPlayerPicking up player.
  • entEntityThe entity being picked up.

Returns

  1. boolean|nilIf the pickup was allowed.
ServerGM:PlyCanPickupRegular(ply, ent) → boolean|nilSource ☍

Can a regular player pickup this entity?

Parameters

  • plyPlayerPicking up player.
  • entEntityThe entity being picked up.

Returns

  1. boolean|nilIf the pickup was allowed.
ClientGM:PreDrawHalos()Source ☍
ClientGM:RenderScreenspaceEffects()Source ☍

Called when screen space effects should be rendered.

ClientGM:Restored() → booleanSource ☍

Returns

  1. boolean
ClientGM:Saved() → booleanSource ☍

Disable saving / restoring buttons.

Returns

  1. boolean
ServerGM:ScalePlayerDamage(ply, hitgroup, damageInfo)Source ☍

Called when a player takes damage to a specific body part. Defined here to shadow base's implementation, which hardcodes head x2 and limb x0.25.

Parameters

  • plyPlayerPlayer which took the damage.
  • hitgroupnumberHITGROUP_* enum of the body part which was hit.
  • damageInfoDamageInfoInformation about the damage.
ClientGM:ScoreboardHide()Source ☍

Hides the scoreboard.

ClientGM:ScoreboardShow()Source ☍

Shows the scoreboard, rebuilding it first if the server has switched version since it was made.

ServerGM:SetupSalary(ply)Source ☍

Set up a player's salary timer.

Parameters

ServerGM:ShowHelp(ply)Source ☍

Called when a player presses F1.

Parameters

  • plyany
ServerGM:ShowSpare2(ply)Source ☍

Called when a player presses F4.

Parameters

  • plyany
ServerGM:ShowTeam(ply)Source ☍

Called when a player presses F2.

Parameters

  • plyany
ServerGM:ShutDown()Source ☍

Called when the server shuts down or the map changes.

ClientGM:StartChat(team) → booleanSource ☍

Called when a player begins typing.

Parameters

  • teamany

Returns

  1. boolean
ServerGM.UpdateDatabase()Source ☍

Update the database and player's data.

ServerGM:VehicleHPChange(ent, delta, cur) → numberSource ☍

Hook function called when vehicle HP changes.

Parameters

  • entEntityVehicle to which the HP change is occuring.
  • deltanumberHP change
  • curnumberCurrent HP.

Returns

  1. numberModified delta.
ServerGM:VehicleHPChanged(veh, new, old)Source ☍

Hook function called after vehicle HP changes.

Parameters

  • vehVehicleVehicle to which the change occured.
  • newnumberCurrent HP
  • oldnumberOld HP
ClientHUD_removeVoicePanel(ply)Source ☍

Parameters

  • plyany
Clientprintf(str, _)Source ☍

Define string formatting functions. These are documented in init.lua

Parameters

  • strany
  • unknown
ServerpTable(tbl, indent)Source ☍

For when PrintTable doesnt work

Parameters

  • tblany
  • indentany
Clientsprintf(str, _)Source ☍

Parameters

  • strany
  • unknown

Tables

ServerBetaWhitelistSource ☍
Servercityrp.AllowedToolsSource ☍
Servercityrp.BlockedToolsSource ☍

This is the file name of the tool to block

ClientGM.ammoCountSource ☍
ServerGM.entitiesSource ☍

A table that will hold entities that were there when the map started.

ClientGM.topTextGradientSource ☍

Set some information for the gamemode.

ClientGM.variableQueueSource ☍

Classes

ServerGMSource ☍

Fields

ClientbillboardSource ☍
Clientcityrp.barheightSource ☍
Servercityrp.BlockedTools.lampSource ☍
Servercityrp.BlockedTools.lightSource ☍
ServerDB_MAINSource ☍
ServerDB_MAIN.debuggingSource ☍
ClientFireEmitterSource ☍
Clientg_VoicePanelListSource ☍
ClientGAMEMODE.playerInitFailedSource ☍
ClientGAMEMODE.playerInitializedSource ☍
ServerGMSource ☍
SharedGM.AuthorSource ☍
SharedGM.EmailSource ☍
SharedGM.NameSource ☍

Name: "sh_init.lua". Product: "CityRP 2 (Roleplay)".

SharedGM.WebsiteSource ☍
ClientlplyvSource ☍
ClientSmokeEmitterSource ☍