What I'm trying to do is copy a thing that was in a roleplay mod so that it is stand-alone, and works seperately.
What the feature was is that you could type a command, and you'd go invisible, and in noclip.
I copied out the two functions and renamed the convar.
I know this is probably massively wrong, but I'd really like to get this working.
[code]
function meta:Observe( bool )
self:GetTable().ObserveMode = bool;
self:SetNoDraw( bool );
if( self:GetActiveWeapon() and self:GetActiveWeapon():IsValid() ) then
self:GetActiveWeapon():SetNoDraw( bool );
end
self:SetNotSolid( bool );
if ( bool ) then
self:SetMoveType( 8 )
self:GodEnable();
else
self:SetMoveType( 2 );
self:GodDisable();
end
end
function AdminObserve( ply, cmd, arg )
if( ply:EntIndex() ~= 0 and not ply:IsSuperAdmin() ) then return; end
if( ply:GetTable().ObserveMode ) then
ply:Observe( false );
else
ply:Observe( true );
end
end
concommand.Add( "admin_observe", AdminObserve );
[/code]
You could just set their movetype to NOCLIP and their color to 255, 255, 255, 0.
[lua]
function AdClip(ply)
if not ply:IsAdmin() then return end -- Checks if player is an admin
if ply.noclip == true then -- Checks if noclip is already enabled if it is then do
ply:SetNoDraw(false) -- Makes the player visible
ply:SetMoveType(MOVETYPE_WALK) -- Removes noclip from the player
ply.noclip = false -- Tell the script noclip was not disabled
return -- Stop executing any more code
end -- Stop the if statement
ply:SetNoDraw(true) -- Make the player invisible
ply:SetMoveType(MOVETYPE_NOCLIP) -- Put the player in noclip
ply.noclip = true -- Tell the script noclip is enabled
end -- End the function
concommand.Add("adclip",AdClip) -- Add a console command to enable the script
[/lua]
Untested.
You never defined meta.
[QUOTE=c-unit;27320844]You could just set their movetype to NOCLIP and their color to 255, 255, 255, 0.[/QUOTE]
*facepalm* you can't set the alpha on players, use ply:SetNoDraw( true ), it's hacky, but it works :P
[QUOTE=Andriko1;27322719]*facepalm* you can't set the alpha on players, use ply:SetNoDraw( true ), it's hacky, but it works :P[/QUOTE]
I have personally done it. So fuck off.
lol reichscript
Here's what I have, it works, but how would I get rid of a players name?
[code]
function AdClip(ply)
if not ply:IsSuperAdmin() then return end -- Checks if player is an admin
if ply.noclip == true then -- Checks if noclip is already enabled if it is then do
ply:GetActiveWeapon():SetNoDraw( false )
ply:SetColor( 255, 255, 255, 255 ) -- Makes the player visible
ply:SetMoveType(MOVETYPE_WALK) -- Removes noclip from the player
ply.noclip = false -- Tell the script noclip was not disabled
return -- Stop executing any more code
end -- Stop the if statement
ply:GetActiveWeapon():SetNoDraw( true )
ply:SetColor( 255, 255, 255, 0 ) -- Make the player invisible
ply:SetMoveType(MOVETYPE_NOCLIP) -- Put the player in noclip
ply.noclip = true -- Tell the script noclip is enabled
end -- End the function
concommand.Add("watch",AdClip) -- Add a console command to enable the script"
[/code]
If you point at the player, you can see their name.
Also, they collide with other players!
Are you using DarkRP?
[QUOTE=zzaacckk;27336278]Are you using DarkRP?[/QUOTE]
Not to test it, it may end up on a DarkRP server though.
Then you cannot remove the players name from being visible without editing the core of the gamemode or object that is setting it.
Also use ply:SetNoDraw(true) instead of setting the players color.
Sounds to me like this is what you want
[b][url=http://wiki.garrysmod.com/?title=Player.Spectate]Player.Spectate [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Use OBS_MODE_ROAMING to fly around invible and OBS_MODE_NONE to go back to normal.
[QUOTE=ralle105;27337292]Sounds to me like this is what you want
[b][url=http://wiki.garrysmod.com/?title=Player.Spectate]Player.Spectate [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb][/url][/b]
Use OBS_MODE_ROAMING to fly around invible and OBS_MODE_NONE to go back to normal.[/QUOTE]
I tried using that method once but OBS_MODE_NONE never worked. Ended up having to respawn the player.. :/
Sorry I lied:saddowns: Use this to go back to normal [b][url=http://wiki.garrysmod.com/?title=Player.UnSpectate]Player.UnSpectate [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Sorry, you need to Log In to post a reply to this thread.