Garry's Mod Wiki

Player:HasGodMode

boolean Player:HasGodMode()

Description

Returns whether the player has god mode or not, contolled by Player:GodEnable and Player:GodDisable.

This is not synced between the client and server. This will cause the client to always return false even in godmode.

Issue Tracker: 2038

Returns

1 boolean
Whether the player has god mode or not.

Example

A fix for accessing this data on client side since you can't at the moment.

if CLIENT then local meta = FindMetaTable( "Player" ) function meta:HasGodMode() return self:GetNWBool( "HasGodMode" ) end end if SERVER then local meta = FindMetaTable( "Player" ) meta.DefaultGodEnable = meta.DefaultGodEnable or meta.GodEnable meta.DefaultGodDisable = meta.DefaultGodDisable or meta.GodDisable function meta:GodEnable() self:SetNWBool( "HasGodMode", true ) self:DefaultGodEnable() end function meta:GodDisable() self:SetNWBool( "HasGodMode", false ) self:DefaultGodDisable() end end

Page Links


Special Pages


Wikis

?

Render Time: 38ms

DB GetPage 4
Generate Html 5
SaveChanges (1) 9
Render Body 0
Render Sidebar 18