Trying to apply godmode on players when they spawn:
hook.Add( "PlayerInitialSpawn", "sa.playerInitialSpawn", function( ply )
print( "Object: " .. tostring( ply ) )
print( "Valid : " .. tostring( IsValid( ply ) ) )
print( "Player: " .. tostring( ply:IsPlayer() ) )
print( "Alive : " .. tostring( ply:Alive() ) )
print( "BGod : " .. tostring( ply:HasGodMode() ) )
ply:GodEnable()
print( "AGod : " .. tostring( ply:HasGodMode() ) )
end )
This outputs:
Object: Player [1][Lukazzz™ - ZammaRP]
Valid : true
Player: true
Alive : true
BGod : false
AGod : true
So godmode should be enabled now, right? Although I can still take fall damage, bullet damage, explosion damage, etc.
Does anyone have to explanation for this?
GM/PlayerInitialSpawn
This hook is called before the player has fully loaded, when the player is still in seeing the "Sending Client Info" screen. For example, trying to use the Entity:GetModel function will return the default model ("player/default.mdl")
Use GM/PlayerSpawn
Sorry, you need to Log In to post a reply to this thread.