This script doesn't work
[CODE]function Plugin:PlayerSpawn( ply )
if ply:IsUserGroup("superadmin") then
ply:GodEnable()
timer.Simple(500, function()
ply:GodDisable()
end)
end
end[/CODE]
It in the folder: ...\garrysmod\lua\autorun\server\
i'm sorry but what are you asking for exactly?
[lua]
hook.Add( "PlayerSpawn", "adminSpawnGodmode" function( ply )
if ply:IsUserGroup( "superadmin" ) then
ply:GodEnable()
timer.Simple( 500, function()
ply:GodDisable()
end )
end
end )
[/lua]
You wanna hook onto PlayerSpawn, not override it. Unless you're making a gamemode or something.
[QUOTE=YourStalker;47374084][lua]
hook.Add( "PlayerSpawn", "adminSpawnGodmode" function( ply )
if ply:IsUserGroup( "superadmin" ) then
ply:GodEnable()
timer.Simple( 500, function()
ply:GodDisable()
end )
end
end )
[/lua]
You wanna hook onto PlayerSpawn, not override it. Unless you're making a gamemode or something.[/QUOTE]
i'm sorry,but the script doesn't work.
[QUOTE=godred2;47374122]i'm sorry,but the script doesn't work.[/QUOTE]
Any errors?
1) You need to check and make sure IsUserGroup returns the correct value
2) You need to use timer.Create, otherwise timer.Simple may stack multiple times and cause them to lose god when they aren't supposed to.
3) You need to check if the player is valid in the timer function.
[QUOTE=YourStalker;47374231]Any errors?[/QUOTE]
no
Here, try this;
[lua]
hook.Add( "PlayerSpawn", "adminSpawnGodmode", function( ply )
if ply:IsAdmin() then
ply:GodEnable()
timer.Simple( 500, function()
ply:GodDisable()
end )
end
end )
[/lua]
Should probably work better.
[QUOTE=Maurdekye;47377147]Here, try this;
[lua]
hook.Add( "PlayerSpawn", "adminSpawnGodmode", function( ply )
if ply:IsAdmin() then
ply:GodEnable()
timer.Simple( 500, function()
ply:GodDisable()
end )
end
end )
[/lua]
Should probably work better.[/QUOTE]
Thx everybody. Work
Sorry, you need to Log In to post a reply to this thread.