function toolnotify(str) local allplayers=player.GetAll() for i=1,table.getn(allplayers) do if allplayers[i]:IsSuperAdmin() and allplayers[i]:GetTable().AdminDebug==true then allplayers[i]:PrintMessage(HUD_PRINTCONSOLE,"-----> TOOLGUN: "..str.."\n") end end end function LimitReachedProcess( ply, str ) if ply:IsUserGroup("superadmin") then return true end if string.find("ms_",str) then return true end local c = server_settings.Int( "sbox_max"..str, 0 ) if ( ply:GetCount( str ) < c || c < 0 ) then return true end ply:LimitHit( str ) return false end function GM:PlayerSpawnProp( ply, model ) return LimitReachedProcess( ply, "props" ) end function GM:PlayerSpawnRagdoll( ply, model ) return LimitReachedProcess( ply, "ragdolls" ) end function GM:PlayerSpawnEffect( ply, model ) return LimitReachedProcess( ply, "effects" ) end function GM:PlayerSpawnVehicle( ply ) return LimitReachedProcess( ply, "vehicles" ) end function GM:PlayerSpawnSENT( ply, name ) return LimitReachedProcess( ply, "sents" ) end function GM:PlayerSpawnNPC( ply, npc_type, equipment ) return LimitReachedProcess( ply, "npcs" ) end function GM:PlayerNoClip( pl, on ) if pl:IsUserGroup("superadmin") or pl:IsUserGroup("admin") or pl:IsUserGroup("trusted") then return true else return false end end function SpawnedProp( userid, model, propid ) str="-> USER "..userid:GetName().." SPAWNED "..model local allplayers=player.GetAll() for i=1,table.getn(allplayers) do if allplayers[i]:IsSuperAdmin() and allplayers[i]:GetTable().AdminDebug==true then allplayers[i]:PrintMessage(HUD_PRINTCONSOLE,"-----> PROP: "..str.."\n") end end end hook.Add( "PlayerSpawnedProp", "msproplog", SpawnedProp ); /*--------------------------------------------------------- Name: gamemode:CanConstrain( ply, trace, mode ) Return true if the player is allowed to do this constrain ---------------------------------------------------------*/ function GM:CanConstrain( ply, trace, mode ) if (ply:IsUserGroup("superadmin")) then return true end if string.find(string.lower(mode),"proximity") and not ply:IsUserGroup("superadmin") then return false end if ( mode == "rope" and trace.Entity:GetClass()=="worldspawn") then return false end -- Not allowed to constrain their fellow players if (trace.Entity:IsValid() && trace.Entity:IsPlayer() or trace.Entity:GetClass()=="worldspawn") then return false end -- Give the entity a chance to decide if ( trace.Entity:GetTable().CanConstrain ) then return trace.Entity:GetTable():CanConstrain( ply, trace, mode ) end --Msg( "Can Constrain "..mode.."\n" ) if trace.Entity:GetTable().owner and not trace.Entity:GetTable().owner==ply:EntIndex() then return false end Msg("-> USER "..ply:Name().." TOOLMODE "..mode.." ENT "..trace.Entity:GetClass().."\n") xstring="-> USER "..ply:Name().." TOOLMODE "..mode.." ENT "..trace.Entity:GetClass() toolnotify(xstring) return true end /*--------------------------------------------------------- Name: gamemode:CanConstruct( ply, trace, mode ) Return true if the player is allowed to do this construction ---------------------------------------------------------*/ function GM:CanConstruct( ply, trace, mode ) if ( mode == "remover" && !trace.Entity:IsValid()) then return false end if ( mode == "rope" and trace.Entity:GetClass()=="worldspawn") then return false end -- The jeep spazzes out when applying something -- todo: Find out what it's reacting badly to and change it in _physprops if ( mode == "physprop" && trace.Entity:IsValid() && trace.Entity:GetClass() == "prop_vehicle_jeep" ) then return false end if (ply:IsUserGroup("superadmin")) then return true end -- Give the entity a chance to decide if ( trace.Entity:GetTable().CanConstruct ) then return trace.Entity:GetTable():CanConstruct( ply, trace, mode ) end if string.find(string.lower(mode),"proximity") and not ply:IsUserGroup("superadmin") then return false end if trace.Entity:GetTable().owner and not trace.Entity:GetTable().owner==ply:EntIndex() then return false end xstring="-> USER "..ply:Name().." TOOLMODE "..mode.." ENT "..trace.Entity:GetClass() toolnotify(xstring) return true end /*--------------------------------------------------------- Name: gamemode:CanPose( ply, trace, mode ) Return true if the player is allowed to do this constrain ---------------------------------------------------------*/ function GM:CanPose( ply, trace, mode ) return true end /*--------------------------------------------------------- Name: gamemode:CanRender( ply, trace, mode ) Return true if the player is allowed to do this constrain ---------------------------------------------------------*/ function GM:CanRender( ply, trace, mode ) if SERVER then if (ply:IsUserGroup("superadmin")) then return true end end if trace.Entity:GetTable().owner and not trace.Entity:GetTable().owner==ply:EntIndex() then return false end return true end /*--------------------------------------------------------- Name: gamemode:CanTool( ply, trace, mode ) Return true if the player is allowed to use this tool ---------------------------------------------------------*/ function GM:CanTool( ply, trace, mode ) -- The jeep spazzes out when applying something -- todo: Find out what it's reacting badly to and change it in _physprops if ( mode == "physprop" && trace.Entity:IsValid() && trace.Entity:GetClass() == "prop_vehicle_jeep" ) then return false end if (ply:IsUserGroup("superadmin")) then return true end if string.find(string.lower(mode),"proximity") and not ply:IsUserGroup("superadmin") then return false end if ( mode == "rope" and trace.Entity:GetClass()=="worldspawn") then return false end if (mode=="colour" and trace.Entity:GetClass()=="ms_radio") then return false end if (mode=="material" and trace.Entity:GetClass()=="ms_radio") then return false end if (mode=="colour" and trace.Entity:GetClass()=="ms_radio_bug") then return false end if (mode=="material" and trace.Entity:GetClass()=="ms_radio_bug") then return false end if (trace.Entity:GetClass()=="func_door" or trace.Entity:GetClass()=="func_door_rotating" or trace.Entity:GetClass()=="prop_door_rotating" or trace.Entity:GetClass()=="func_breakable_surf" or trace.Entity:GetClass()=="func_button" or trace.Entity:GetClass()=="func_physbox" or trace.Entity:GetClass()=="func_tracktrain" or trace.Entity:GetClass()=="func_wall_toggle" ) then return false end -- Give the entity a chance to decide if ( trace.Entity:GetTable().CanTool ) then return trace.Entity:GetTable():CanTool( ply, trace, mode ) end if trace.Entity:GetTable().owner and not trace.Entity:GetTable().owner==ply:EntIndex() then return false end xstring="-> USER "..ply:Name().." TOOLMODE "..mode.." ENT "..trace.Entity:GetClass() toolnotify(xstring) return true end /*--------------------------------------------------------- Name: gamemode:GravGunPunt( ) Desc: We're about to punt an entity (primary fire). Return true if we're allowed to. ---------------------------------------------------------*/ function GM:GravGunPunt( ply, ent ) if ( ent:IsValid() && ent:GetTable().GravGunPunt ) then return ent:GetTable():GravGunPunt( ply ) end return self.BaseClass:GravGunPunt( ply, ent ) end /*--------------------------------------------------------- Name: gamemode:GravGunPickupAllowed( ) Desc: Return true if we're allowed to pickup entity ---------------------------------------------------------*/ function GM:GravGunPickupAllowed( ply, ent ) if ( ent:IsValid() && ent:GetTable().GravGunPickupAllowed ) then return ent:GetTable():GravGunPickupAllowed( ply ) end return self.BaseClass:GravGunPickupAllowed( ply, ent ) end /*--------------------------------------------------------- Name: gamemode:PhysgunPickup( ) Desc: Return true if player can pickup entity ---------------------------------------------------------*/ function GM:PhysgunPickup( ply, ent ) if (ply:IsUserGroup("superadmin")) and ent:GetClass()=="player" then return true end if ( ent:IsValid() && ent:GetTable().PhysgunPickup ) then return ent:GetTable():PhysgunPickup( ply ) end if (ent:GetClass()=="func_door" or ent:GetClass()=="func_door_rotating" or ent:GetClass()=="prop_door_rotating" or ent:GetClass()=="func_button" or ent:GetClass()=="func_breakable_surf" or ent:GetClass()=="func_wall_toggle" ) then return false end return self.BaseClass:PhysgunPickup( ply, ent ) end